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