Changes in src/sas/sasgui/guiframe/aboutbox.py [b963b20:959eb01] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/aboutbox.py
rb963b20 r959eb01 24 24 import os.path 25 25 import os 26 27 from sas import get_local_config 28 config = get_local_config() 26 try: 27 # Try to find a local config 28 import imp 29 path = os.getcwd() 30 if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ 31 (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 32 fObj, path, descr = imp.find_module('local_config', [path]) 33 config = imp.load_module('local_config', fObj, path, descr) 34 else: 35 # Try simply importing local_config 36 import local_config as config 37 except: 38 # Didn't find local config, load the default 39 import config 29 40 30 41 def launchBrowser(url): 31 42 """ 32 43 Launches browser and opens specified url 33 44 34 45 In some cases may require BROWSER environment variable to be set up. 35 46 36 47 :param url: URL to open 37 48 38 49 """ 39 50 import webbrowser … … 44 55 """ 45 56 "About" Dialog 46 57 47 58 Shows product name, current version, authors, and link to the product page. 48 59 Current version is taken from version.py 49 50 """ 51 60 61 """ 62 52 63 def __init__(self, *args, **kwds): 53 64 … … 55 66 kwds["style"] = wx.DEFAULT_DIALOG_STYLE 56 67 wx.Dialog.__init__(self, *args, **kwds) 57 68 58 69 file_dir = os.path.dirname(__file__) 59 70 60 71 # Mac doesn't display images with transparent background so well, 61 72 # keep it for Windows 62 73 image = file_dir + "/images/angles_flat.png" 63 74 64 75 if os.path.isfile(config._corner_image): 65 76 image = config._corner_image … … 69 80 else: 70 81 self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image)) 71 82 72 83 self.label_title = wx.StaticText(self, -1, config.__appname__) 73 84 self.label_version = wx.StaticText(self, -1, "") … … 101 112 #self.bitmap_button_danse = wx.BitmapButton(self, -1, wx.NullBitmap) 102 113 self.bitmap_button_msu = wx.BitmapButton(self, -1, wx.NullBitmap) 103 114 104 115 self.bitmap_button_isis = wx.BitmapButton(self, -1, wx.NullBitmap) 105 116 self.bitmap_button_ess = wx.BitmapButton(self, -1, wx.NullBitmap) … … 108 119 self.bitmap_button_tudelft = wx.BitmapButton(self, -1, wx.NullBitmap) 109 120 self.bitmap_button_dls = wx.BitmapButton(self, -1, wx.NullBitmap) 110 121 111 122 self.static_line_3 = wx.StaticLine(self, -1) 112 123 self.button_OK = wx.Button(self, wx.ID_OK, "OK") … … 114 125 self.__set_properties() 115 126 self.__do_layout() 116 127 117 128 self.Bind(wx.EVT_BUTTON, self.onNistLogo, self.bitmap_button_nist) 118 129 self.Bind(wx.EVT_BUTTON, self.onUmdLogo, self.bitmap_button_umd) … … 134 145 random.shuffle(config._authors) 135 146 strLabel = ", ".join(config._authors) 136 147 137 148 # display version and svn revison numbers 138 149 verwords = config.__version__.split('.') … … 146 157 self.label_version.SetLabel(config.__version__)#(version) 147 158 self.label_svnrevision.SetLabel(build_num) 148 159 149 160 # set bitmaps for logo buttons 150 161 image = file_dir + "/images/nist_logo.png" 151 162 if os.path.isfile(config._nist_logo): 152 163 image = config._nist_logo 153 logo = wx.Bitmap(image) 164 logo = wx.Bitmap(image) 154 165 self.bitmap_button_nist.SetBitmapLabel(logo) 155 166 156 167 image = file_dir + "/images/umd_logo.png" 157 168 if os.path.isfile(config._umd_logo): 158 169 image = config._umd_logo 159 logo = wx.Bitmap(image) 170 logo = wx.Bitmap(image) 160 171 self.bitmap_button_umd.SetBitmapLabel(logo) 161 172 … … 163 174 if os.path.isfile(config._ornl_logo): 164 175 image = config._ornl_logo 165 logo = wx.Bitmap(image) 176 logo = wx.Bitmap(image) 166 177 self.bitmap_button_ornl.SetBitmapLabel(logo) 167 178 … … 170 181 if os.path.isfile(config._sns_logo): 171 182 image = config._sns_logo 172 logo = wx.Bitmap(image) 183 logo = wx.Bitmap(image) 173 184 self.bitmap_button_sns.SetBitmapLabel(logo) 174 185 175 186 image = file_dir + "/images/nsf_logo.png" 176 187 if os.path.isfile(config._nsf_logo): 177 188 image = config._nsf_logo 178 logo = wx.Bitmap(image) 189 logo = wx.Bitmap(image) 179 190 self.bitmap_button_nsf.SetBitmapLabel(logo) 180 191 … … 185 196 self.bitmap_button_danse.SetBitmapLabel(logo) 186 197 """ 187 image = file_dir + "/images/utlogo. png"198 image = file_dir + "/images/utlogo.gif" 188 199 if os.path.isfile(config._inst_logo): 189 200 image = config._inst_logo 190 201 logo = wx.Bitmap(image) 191 202 self.bitmap_button_msu.SetBitmapLabel(logo) 192 203 193 204 image = file_dir + "/images/isis_logo.png" 194 205 if os.path.isfile(config._isis_logo): 195 206 image = config._isis_logo 196 logo = wx.Bitmap(image) 207 logo = wx.Bitmap(image) 197 208 self.bitmap_button_isis.SetBitmapLabel(logo) 198 209 … … 202 213 logo = wx.Bitmap(image) 203 214 self.bitmap_button_ess.SetBitmapLabel(logo) 204 215 205 216 image = file_dir + "/images/ill_logo.png" 206 217 if os.path.isfile(config._ill_logo): … … 208 219 logo = wx.Bitmap(image) 209 220 self.bitmap_button_ill.SetBitmapLabel(logo) 210 221 211 222 image = file_dir + "/images/ansto_logo.png" 212 223 if os.path.isfile(config._ansto_logo): … … 214 225 logo = wx.Bitmap(image) 215 226 self.bitmap_button_ansto.SetBitmapLabel(logo) 216 227 217 228 image = file_dir + "/images/tudelft_logo.png" 218 229 if os.path.isfile(config._tudelft_logo): … … 220 231 logo = wx.Bitmap(image) 221 232 self.bitmap_button_tudelft.SetBitmapLabel(logo) 222 233 223 234 image = file_dir + "/images/dls_logo.png" 224 235 if os.path.isfile(config._dls_logo): … … 226 237 logo = wx.Bitmap(image) 227 238 self.bitmap_button_dls.SetBitmapLabel(logo) 228 239 229 240 # resize dialog window to fit version number nicely 230 241 if wx.VERSION >= (2, 7, 2, 0): … … 233 244 size = [self.GetBestFittingSize()[0], self.GetSize()[1]] 234 245 self.Fit() 235 246 236 247 def __set_properties(self): 237 248 """ … … 299 310 sizer_main.Add(self.static_line_2, 0, wx.EXPAND, 0) 300 311 301 sizer_logos.Add(self.bitmap_button_msu, 0, 312 sizer_logos.Add(self.bitmap_button_msu, 0, 302 313 wx.LEFT|wx.ADJUST_MINSIZE, 2) 303 314 #sizer_logos.Add(self.bitmap_button_danse, 0, 304 315 # wx.LEFT|wx.ADJUST_MINSIZE, 2) 305 #sizer_logos.Add(self.bitmap_button_nsf, 0, 316 #sizer_logos.Add(self.bitmap_button_nsf, 0, 306 317 # wx.LEFT|wx.ADJUST_MINSIZE, 2) 307 sizer_logos.Add(self.bitmap_button_umd, 0, 308 wx.LEFT|wx.ADJUST_MINSIZE, 2) 309 sizer_logos.Add(self.bitmap_button_nist, 0, 310 wx.LEFT|wx.ADJUST_MINSIZE, 2) 311 #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, 312 323 # wx.LEFT|wx.ADJUST_MINSIZE, 2) 313 sizer_logos.Add(self.bitmap_button_ornl, 0, 314 wx.LEFT|wx.ADJUST_MINSIZE, 2) 315 sizer_logos.Add(self.bitmap_button_isis, 0, 316 wx.LEFT|wx.ADJUST_MINSIZE, 2) 317 sizer_logos.Add(self.bitmap_button_ess, 0, 318 wx.LEFT|wx.ADJUST_MINSIZE, 2) 319 sizer_logos.Add(self.bitmap_button_ill, 0, 320 wx.LEFT|wx.ADJUST_MINSIZE, 2) 321 sizer_logos.Add(self.bitmap_button_ansto, 0, 322 wx.LEFT|wx.ADJUST_MINSIZE, 2) 323 sizer_logos.Add(self.bitmap_button_tudelft, 0, 324 wx.LEFT|wx.ADJUST_MINSIZE, 2) 325 sizer_logos.Add(self.bitmap_button_dls, 0, 326 wx.LEFT|wx.ADJUST_MINSIZE, 2) 327 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 328 339 sizer_logos.Add((10, 50), 0, wx.ADJUST_MINSIZE, 0) 329 340 sizer_main.Add(sizer_logos, 0, wx.EXPAND, 0) 330 341 sizer_main.Add(self.static_line_3, 0, wx.EXPAND, 0) 331 342 sizer_button.Add((20, 40), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 332 sizer_button.Add(self.button_OK, 0, 343 sizer_button.Add(self.button_OK, 0, 333 344 wx.RIGHT|wx.ADJUST_MINSIZE|wx.CENTER, 10) 334 345 sizer_main.Add(sizer_button, 0, wx.EXPAND, 0) … … 339 350 # end wxGlade 340 351 341 def onNistLogo(self, event): 352 def onNistLogo(self, event): 342 353 """ 343 354 """ … … 345 356 launchBrowser(config._nist_url) 346 357 event.Skip() 347 348 def onUmdLogo(self, event): 358 359 def onUmdLogo(self, event): 349 360 """ 350 361 """ … … 352 363 launchBrowser(config._umd_url) 353 364 event.Skip() 354 355 def onOrnlLogo(self, event): 365 366 def onOrnlLogo(self, event): 356 367 """ 357 368 """ … … 359 370 launchBrowser(config._ornl_url) 360 371 event.Skip() 361 362 def onSnsLogo(self, event): 372 373 def onSnsLogo(self, event): 363 374 """ 364 375 """ … … 366 377 launchBrowser(config._sns_url) 367 378 event.Skip() 368 369 def onNsfLogo(self, event): 379 380 def onNsfLogo(self, event): 370 381 """ 371 382 """ … … 383 394 def onUTLogo(self, event): 384 395 """ 385 """ 396 """ 386 397 # wxGlade: DialogAbout.<event_handler> 387 398 launchBrowser(config._inst_url) 388 399 event.Skip() 389 400 390 def onIsisLogo(self, event): 401 def onIsisLogo(self, event): 391 402 """ 392 403 """ … … 404 415 def onIllLogo(self, event): 405 416 """ 406 """ 417 """ 407 418 # wxGlade: DialogAbout.<event_handler> 408 419 launchBrowser(config._ill_url) … … 411 422 def onAnstoLogo(self, event): 412 423 """ 413 """ 424 """ 414 425 # wxGlade: DialogAbout.<event_handler> 415 426 launchBrowser(config._ansto_url) … … 418 429 def onTudelftLogo(self, event): 419 430 """ 420 """ 431 """ 421 432 # wxGlade: DialogAbout.<event_handler> 422 433 launchBrowser(config._tudelft_url) … … 425 436 def onDlsLogo(self, event): 426 437 """ 427 """ 438 """ 428 439 # wxGlade: DialogAbout.<event_handler> 429 440 launchBrowser(config._dls_url) … … 451 462 app = MyApp(0) 452 463 app.MainLoop() 453 454 ##### end of testing code ##################################################### 464 465 ##### end of testing code #####################################################
Note: See TracChangeset
for help on using the changeset viewer.