Changeset dce368f in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Jun 16, 2017 1:01:44 PM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 8f1bb6f
- Parents:
- e9df8a5 (diff), f2ea95a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/sasgui/guiframe
- Files:
-
- 2 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/aboutbox.py
r959eb01 rf2ea95a 31 31 (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 32 32 fObj, path, descr = imp.find_module('local_config', [path]) 33 config = imp.load_module('local_config', fObj, path, descr) 33 config = imp.load_module('local_config', fObj, path, descr) 34 34 else: 35 35 # Try simply importing local_config 36 36 import local_config as config 37 37 except: 38 # Didn't find local config, load the default 38 # Didn't find local config, load the default 39 39 import config 40 40 … … 42 42 """ 43 43 Launches browser and opens specified url 44 44 45 45 In some cases may require BROWSER environment variable to be set up. 46 46 47 47 :param url: URL to open 48 48 49 49 """ 50 50 import webbrowser … … 55 55 """ 56 56 "About" Dialog 57 57 58 58 Shows product name, current version, authors, and link to the product page. 59 59 Current version is taken from version.py 60 61 """ 62 60 61 """ 62 63 63 def __init__(self, *args, **kwds): 64 64 … … 66 66 kwds["style"] = wx.DEFAULT_DIALOG_STYLE 67 67 wx.Dialog.__init__(self, *args, **kwds) 68 68 69 69 file_dir = os.path.dirname(__file__) 70 70 71 71 # Mac doesn't display images with transparent background so well, 72 72 # keep it for Windows 73 73 image = file_dir + "/images/angles_flat.png" 74 74 75 75 if os.path.isfile(config._corner_image): 76 76 image = config._corner_image … … 80 80 else: 81 81 self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image)) 82 82 83 83 self.label_title = wx.StaticText(self, -1, config.__appname__) 84 84 self.label_version = wx.StaticText(self, -1, "") … … 112 112 #self.bitmap_button_danse = wx.BitmapButton(self, -1, wx.NullBitmap) 113 113 self.bitmap_button_msu = wx.BitmapButton(self, -1, wx.NullBitmap) 114 114 115 115 self.bitmap_button_isis = wx.BitmapButton(self, -1, wx.NullBitmap) 116 116 self.bitmap_button_ess = wx.BitmapButton(self, -1, wx.NullBitmap) … … 119 119 self.bitmap_button_tudelft = wx.BitmapButton(self, -1, wx.NullBitmap) 120 120 self.bitmap_button_dls = wx.BitmapButton(self, -1, wx.NullBitmap) 121 121 122 122 self.static_line_3 = wx.StaticLine(self, -1) 123 123 self.button_OK = wx.Button(self, wx.ID_OK, "OK") … … 125 125 self.__set_properties() 126 126 self.__do_layout() 127 127 128 128 self.Bind(wx.EVT_BUTTON, self.onNistLogo, self.bitmap_button_nist) 129 129 self.Bind(wx.EVT_BUTTON, self.onUmdLogo, self.bitmap_button_umd) … … 145 145 random.shuffle(config._authors) 146 146 strLabel = ", ".join(config._authors) 147 147 148 148 # display version and svn revison numbers 149 149 verwords = config.__version__.split('.') … … 157 157 self.label_version.SetLabel(config.__version__)#(version) 158 158 self.label_svnrevision.SetLabel(build_num) 159 159 160 160 # set bitmaps for logo buttons 161 161 image = file_dir + "/images/nist_logo.png" 162 162 if os.path.isfile(config._nist_logo): 163 163 image = config._nist_logo 164 logo = wx.Bitmap(image) 164 logo = wx.Bitmap(image) 165 165 self.bitmap_button_nist.SetBitmapLabel(logo) 166 166 167 167 image = file_dir + "/images/umd_logo.png" 168 168 if os.path.isfile(config._umd_logo): 169 169 image = config._umd_logo 170 logo = wx.Bitmap(image) 170 logo = wx.Bitmap(image) 171 171 self.bitmap_button_umd.SetBitmapLabel(logo) 172 172 … … 174 174 if os.path.isfile(config._ornl_logo): 175 175 image = config._ornl_logo 176 logo = wx.Bitmap(image) 176 logo = wx.Bitmap(image) 177 177 self.bitmap_button_ornl.SetBitmapLabel(logo) 178 178 … … 181 181 if os.path.isfile(config._sns_logo): 182 182 image = config._sns_logo 183 logo = wx.Bitmap(image) 183 logo = wx.Bitmap(image) 184 184 self.bitmap_button_sns.SetBitmapLabel(logo) 185 185 186 186 image = file_dir + "/images/nsf_logo.png" 187 187 if os.path.isfile(config._nsf_logo): 188 188 image = config._nsf_logo 189 logo = wx.Bitmap(image) 189 logo = wx.Bitmap(image) 190 190 self.bitmap_button_nsf.SetBitmapLabel(logo) 191 191 … … 196 196 self.bitmap_button_danse.SetBitmapLabel(logo) 197 197 """ 198 image = file_dir + "/images/utlogo. gif"198 image = file_dir + "/images/utlogo.png" 199 199 if os.path.isfile(config._inst_logo): 200 200 image = config._inst_logo 201 201 logo = wx.Bitmap(image) 202 202 self.bitmap_button_msu.SetBitmapLabel(logo) 203 203 204 204 image = file_dir + "/images/isis_logo.png" 205 205 if os.path.isfile(config._isis_logo): 206 206 image = config._isis_logo 207 logo = wx.Bitmap(image) 207 logo = wx.Bitmap(image) 208 208 self.bitmap_button_isis.SetBitmapLabel(logo) 209 209 … … 213 213 logo = wx.Bitmap(image) 214 214 self.bitmap_button_ess.SetBitmapLabel(logo) 215 215 216 216 image = file_dir + "/images/ill_logo.png" 217 217 if os.path.isfile(config._ill_logo): … … 219 219 logo = wx.Bitmap(image) 220 220 self.bitmap_button_ill.SetBitmapLabel(logo) 221 221 222 222 image = file_dir + "/images/ansto_logo.png" 223 223 if os.path.isfile(config._ansto_logo): … … 225 225 logo = wx.Bitmap(image) 226 226 self.bitmap_button_ansto.SetBitmapLabel(logo) 227 227 228 228 image = file_dir + "/images/tudelft_logo.png" 229 229 if os.path.isfile(config._tudelft_logo): … … 231 231 logo = wx.Bitmap(image) 232 232 self.bitmap_button_tudelft.SetBitmapLabel(logo) 233 233 234 234 image = file_dir + "/images/dls_logo.png" 235 235 if os.path.isfile(config._dls_logo): … … 237 237 logo = wx.Bitmap(image) 238 238 self.bitmap_button_dls.SetBitmapLabel(logo) 239 239 240 240 # resize dialog window to fit version number nicely 241 241 if wx.VERSION >= (2, 7, 2, 0): … … 244 244 size = [self.GetBestFittingSize()[0], self.GetSize()[1]] 245 245 self.Fit() 246 246 247 247 def __set_properties(self): 248 248 """ … … 310 310 sizer_main.Add(self.static_line_2, 0, wx.EXPAND, 0) 311 311 312 sizer_logos.Add(self.bitmap_button_msu, 0, 312 sizer_logos.Add(self.bitmap_button_msu, 0, 313 313 wx.LEFT|wx.ADJUST_MINSIZE, 2) 314 314 #sizer_logos.Add(self.bitmap_button_danse, 0, 315 315 # wx.LEFT|wx.ADJUST_MINSIZE, 2) 316 #sizer_logos.Add(self.bitmap_button_nsf, 0, 316 #sizer_logos.Add(self.bitmap_button_nsf, 0, 317 317 # wx.LEFT|wx.ADJUST_MINSIZE, 2) 318 sizer_logos.Add(self.bitmap_button_umd, 0, 319 wx.LEFT|wx.ADJUST_MINSIZE, 2) 320 sizer_logos.Add(self.bitmap_button_nist, 0, 321 wx.LEFT|wx.ADJUST_MINSIZE, 2) 322 #sizer_logos.Add(self.bitmap_button_sns, 0, 318 sizer_logos.Add(self.bitmap_button_umd, 0, 319 wx.LEFT|wx.ADJUST_MINSIZE, 2) 320 sizer_logos.Add(self.bitmap_button_nist, 0, 321 wx.LEFT|wx.ADJUST_MINSIZE, 2) 322 #sizer_logos.Add(self.bitmap_button_sns, 0, 323 323 # wx.LEFT|wx.ADJUST_MINSIZE, 2) 324 sizer_logos.Add(self.bitmap_button_ornl, 0, 325 wx.LEFT|wx.ADJUST_MINSIZE, 2) 326 sizer_logos.Add(self.bitmap_button_isis, 0, 327 wx.LEFT|wx.ADJUST_MINSIZE, 2) 328 sizer_logos.Add(self.bitmap_button_ess, 0, 329 wx.LEFT|wx.ADJUST_MINSIZE, 2) 330 sizer_logos.Add(self.bitmap_button_ill, 0, 331 wx.LEFT|wx.ADJUST_MINSIZE, 2) 332 sizer_logos.Add(self.bitmap_button_ansto, 0, 333 wx.LEFT|wx.ADJUST_MINSIZE, 2) 334 sizer_logos.Add(self.bitmap_button_tudelft, 0, 335 wx.LEFT|wx.ADJUST_MINSIZE, 2) 336 sizer_logos.Add(self.bitmap_button_dls, 0, 337 wx.LEFT|wx.ADJUST_MINSIZE, 2) 338 324 sizer_logos.Add(self.bitmap_button_ornl, 0, 325 wx.LEFT|wx.ADJUST_MINSIZE, 2) 326 sizer_logos.Add(self.bitmap_button_isis, 0, 327 wx.LEFT|wx.ADJUST_MINSIZE, 2) 328 sizer_logos.Add(self.bitmap_button_ess, 0, 329 wx.LEFT|wx.ADJUST_MINSIZE, 2) 330 sizer_logos.Add(self.bitmap_button_ill, 0, 331 wx.LEFT|wx.ADJUST_MINSIZE, 2) 332 sizer_logos.Add(self.bitmap_button_ansto, 0, 333 wx.LEFT|wx.ADJUST_MINSIZE, 2) 334 sizer_logos.Add(self.bitmap_button_tudelft, 0, 335 wx.LEFT|wx.ADJUST_MINSIZE, 2) 336 sizer_logos.Add(self.bitmap_button_dls, 0, 337 wx.LEFT|wx.ADJUST_MINSIZE, 2) 338 339 339 sizer_logos.Add((10, 50), 0, wx.ADJUST_MINSIZE, 0) 340 340 sizer_main.Add(sizer_logos, 0, wx.EXPAND, 0) 341 341 sizer_main.Add(self.static_line_3, 0, wx.EXPAND, 0) 342 342 sizer_button.Add((20, 40), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 343 sizer_button.Add(self.button_OK, 0, 343 sizer_button.Add(self.button_OK, 0, 344 344 wx.RIGHT|wx.ADJUST_MINSIZE|wx.CENTER, 10) 345 345 sizer_main.Add(sizer_button, 0, wx.EXPAND, 0) … … 350 350 # end wxGlade 351 351 352 def onNistLogo(self, event): 352 def onNistLogo(self, event): 353 353 """ 354 354 """ … … 356 356 launchBrowser(config._nist_url) 357 357 event.Skip() 358 359 def onUmdLogo(self, event): 358 359 def onUmdLogo(self, event): 360 360 """ 361 361 """ … … 363 363 launchBrowser(config._umd_url) 364 364 event.Skip() 365 366 def onOrnlLogo(self, event): 365 366 def onOrnlLogo(self, event): 367 367 """ 368 368 """ … … 370 370 launchBrowser(config._ornl_url) 371 371 event.Skip() 372 373 def onSnsLogo(self, event): 372 373 def onSnsLogo(self, event): 374 374 """ 375 375 """ … … 377 377 launchBrowser(config._sns_url) 378 378 event.Skip() 379 380 def onNsfLogo(self, event): 379 380 def onNsfLogo(self, event): 381 381 """ 382 382 """ … … 394 394 def onUTLogo(self, event): 395 395 """ 396 """ 396 """ 397 397 # wxGlade: DialogAbout.<event_handler> 398 398 launchBrowser(config._inst_url) 399 399 event.Skip() 400 400 401 def onIsisLogo(self, event): 401 def onIsisLogo(self, event): 402 402 """ 403 403 """ … … 415 415 def onIllLogo(self, event): 416 416 """ 417 """ 417 """ 418 418 # wxGlade: DialogAbout.<event_handler> 419 419 launchBrowser(config._ill_url) … … 422 422 def onAnstoLogo(self, event): 423 423 """ 424 """ 424 """ 425 425 # wxGlade: DialogAbout.<event_handler> 426 426 launchBrowser(config._ansto_url) … … 429 429 def onTudelftLogo(self, event): 430 430 """ 431 """ 431 """ 432 432 # wxGlade: DialogAbout.<event_handler> 433 433 launchBrowser(config._tudelft_url) … … 436 436 def onDlsLogo(self, event): 437 437 """ 438 """ 438 """ 439 439 # wxGlade: DialogAbout.<event_handler> 440 440 launchBrowser(config._dls_url) … … 462 462 app = MyApp(0) 463 463 app.MainLoop() 464 465 ##### end of testing code ##################################################### 464 465 ##### end of testing code ##################################################### -
src/sas/sasgui/guiframe/config.py
ra1b8fee rf2ea95a 77 77 _nsf_logo = os.path.join(icon_path, "nsf_logo.png") 78 78 _danse_logo = os.path.join(icon_path, "danse_logo.png") 79 _inst_logo = os.path.join(icon_path, "utlogo. gif")79 _inst_logo = os.path.join(icon_path, "utlogo.png") 80 80 _nist_url = "http://www.nist.gov/" 81 81 _umd_url = "http://www.umd.edu/" -
src/sas/sasgui/guiframe/media/graph_help.rst
rf9b0c81 r5ed76f8 9 9 10 10 SasView generates three different types of graph window: one that displays *1D data* 11 (i e, I(Q) vs Q), one that displays *1D residuals* (ie, the difference between the12 experimental data and the theory at the same Qvalues), and *2D color maps*.11 (i.e., $I(Q)$ vs $Q$), one that displays *1D residuals* (ie, the difference between the 12 experimental data and the theory at the same $Q$ values), and *2D color maps*. 13 13 14 14 Graph window options … … 42 42 plot window. 43 43 44 .. note:: 44 .. note:: 45 45 *If a residuals graph (when fitting data) is hidden, it will not show up 46 46 after computation.* … … 138 138 style and size. *Remove Text* will remove the last annotation added. To change 139 139 the legend. *Window Title* allows a custom title to be entered instead of Graph 140 x. 140 x. 141 141 142 142 Changing scales … … 226 226 ^^^^^^^^^^^^^^^^^^^ 227 227 228 Linear fit performs a simple ( y(x)=ax+b )linear fit within the plot window.228 Linear fit performs a simple $y(x)=ax+b$ linear fit within the plot window. 229 229 230 230 In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Linear Fit*. A … … 234 234 235 235 This option is most useful for performing simple Guinier, XS Guinier, and 236 Porod type analyses, for example, to estimate Rg, a rod diameter, or incoherent236 Porod type analyses, for example, to estimate $R_g$, a rod diameter, or incoherent 237 237 background level, respectively. 238 238 … … 319 319 ^^^^^^^^^^^^^^^^^^^^^^^^^ 320 320 321 This operation will perform an average in constant Q-rings around the (x,y)321 This operation will perform an average in constant $Q$ rings around the (x,y) 322 322 pixel location of the beam center. 323 323 … … 331 331 ^^^^^^^^^^^^^^^^^^^^^^^ 332 332 333 This operation averages in constant Q-arcs.334 335 The width of the sector is specified in degrees ( +/- |delta|\|phi|\) each side336 of the central angle (|phi|\).337 338 Annular average [ |phi| View]339 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 340 341 This operation performs an average between two Q-values centered on (0,0),333 This operation averages in constant $Q$ arcs. 334 335 The width of the sector is specified in degrees ($\pm\delta|\phi|$) each side 336 of the central angle $\phi$. 337 338 Annular average [:math:`\phi`] 339 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 340 341 This operation performs an average between two $Q$ values centered on (0,0), 342 342 and averaged over a specified number of pixels. 343 343 344 The data is returned as a function of angle (|phi|\)in degrees with zero344 The data is returned as a function of angle $\phi$ in degrees with zero 345 345 degrees at the 3 O'clock position. 346 346 … … 356 356 ^^^^^^^^^^^^^^^^^^^ 357 357 358 This operation computes an average I(Qx)for the region of interest.358 This operation computes an average $I(Q_x)$ for the region of interest. 359 359 360 360 When editing the slicer parameters, the user can control the length and the 361 361 width the rectangular slicer. The averaged output is calculated from constant 362 bins with rectangular shape. The resultant Qvalues are nominal values, that362 bins with rectangular shape. The resultant $Q$ values are nominal values, that 363 363 is, the central value of each bin on the x-axis. 364 364 … … 366 366 ^^^^^^^^^^^^^^^^^^^ 367 367 368 This operation computes an average I(Qy)for the region of interest.368 This operation computes an average $I(Q_y)$ for the region of interest. 369 369 370 370 When editing the slicer parameters, the user can control the length and the 371 371 width the rectangular slicer. The averaged output is calculated from constant 372 bins with rectangular shape. The resultant Qvalues are nominal values, that372 bins with rectangular shape. The resultant $Q$ values are nominal values, that 373 373 is, the central value of each bin on the x-axis. 374 374 -
src/sas/sasgui/guiframe/documentation_window.py
r959eb01 r9d566b2 16 16 import os 17 17 import logging 18 import wx19 18 import webbrowser 20 19 import urllib 21 20 import sys 22 21 22 import wx 23 try: 24 import wx.html2 as html 25 WX_SUPPORTS_HTML2 = True 26 except ImportError: 27 WX_SUPPORTS_HTML2 = False 28 29 from .gui_manager import get_app_dir 30 23 31 logger = logging.getLogger(__name__) 24 32 25 33 SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 26 WX_SUPPORTS_HTML2 = True27 try:28 import wx.html2 as html29 except:30 WX_SUPPORTS_HTML2 = False31 34 35 THREAD_STARTED = False 36 def start_documentation_server(doc_root, port): 37 import thread 38 global THREAD_STARTED 39 if not THREAD_STARTED: 40 thread.start_new_thread(_documentation_server, (doc_root, port)) 41 THREAD_STARTED = True 32 42 33 from gui_manager import get_app_dir 43 def _documentation_server(doc_root, port): 44 from SimpleHTTPServer import SimpleHTTPRequestHandler 45 from SocketServer import TCPServer 34 46 47 os.chdir(doc_root) 48 httpd = TCPServer(("127.0.0.1", port), SimpleHTTPRequestHandler, bind_and_activate=False) 49 httpd.allow_reuse_address = True 50 try: 51 httpd.server_bind() 52 httpd.server_activate() 53 httpd.serve_forever() 54 finally: 55 httpd.server_close() 35 56 36 57 class DocumentationWindow(wx.Frame): … … 70 91 #Note added June 21, 2015 PDB 71 92 file_path = os.path.join(docs_path, path) 72 url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 73 74 if not os.path.exists(file_path): 93 if path.startswith('http'): 94 url = path 95 elif not os.path.exists(file_path): 96 url = "index.html" 75 97 logger.error("Could not find Sphinx documentation at %s \ 76 98 -- has it been built?", file_path) 77 elif WX_SUPPORTS_HTML2: 99 elif True: 100 start_documentation_server(docs_path, port=7999) 101 url = "http://localhost:7999/" + path.replace('\\', '/') + url_instruction 102 else: 103 url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 104 105 logger.info("showing url " + url) 106 if WX_SUPPORTS_HTML2: 78 107 # Complete HTML/CSS support! 79 108 self.view = html.WebView.New(self) 80 109 self.view.LoadURL(url) 110 self.Bind(html.EVT_WEBVIEW_ERROR, self.OnError, self.view) 81 111 self.Show() 82 112 else: … … 88 118 webbrowser.open_new_tab(url) 89 119 120 def OnError(self, evt): 121 logger.error("%d: %s", evt.GetInt(), evt.GetString()) 122 90 123 def main(): 91 124 """ 92 125 main loop function if running alone for testing. 93 126 """ 127 url = "index.html" if len(sys.argv) <= 1 else sys.argv[1] 94 128 app = wx.App() 95 DocumentationWindow(None, -1, "index.html", "", "Documentation",)129 DocumentationWindow(None, -1, url, "", "Documentation",) 96 130 app.MainLoop() 97 131
Note: See TracChangeset
for help on using the changeset viewer.