Skip to content

Commit 66495c3

Browse files
committed
Warn on Bilbao down; minor docs/cleanup stuff
1 parent ffddb48 commit 66495c3

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

GSASII/GSASIIctrlGUI.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@ def ShowScrolledInfo(parent,txt,width=600,height=400,header='Warning info',
26042604
returns wx.ID_CANCEL
26052605
:returns: the wx Id for the selected button
26062606
2607-
example::
2607+
Example::
26082608
26092609
res = ShowScrolledInfo(self.frame,msg,header='Please Note',buttonlist=[
26102610
('Open', lambda event: event.GetEventObject().GetParent().EndModal(wx.ID_OK)),
@@ -3691,6 +3691,14 @@ def ItemSelector(ChoiceList, ParentFrame=None,
36913691
:returns: the selection index or None or a selection list if multiple is true
36923692
36933693
Called by GSASIIdataGUI.OnReOrgSelSeq() Which is not fully implemented.
3694+
3695+
Example::
3696+
3697+
choices = ('NXazint1d 1D file','NXazint1d 2D file')
3698+
sel = G2G.ItemSelector(choices, ParentFrame=ParentFrame,
3699+
header='Select file section',
3700+
title='Select the section of the file to read')
3701+
if sel is None: return False
36943702
'''
36953703
if multiple:
36963704
if useCancel:
@@ -6225,7 +6233,7 @@ def tblLine(dlg,pixels=3):
62256233
dlg.Destroy()
62266234

62276235
################################################################################
6228-
def viewWebPage(parent,URL,size=(750,450),newFrame=False,HTML=''):
6236+
def viewWebPage(parent,URL='',size=(750,450),newFrame=False,HTML=''):
62296237
'''Creates a child wx.Frame with an OS-managed web browser. The window
62306238
is modeless, so it can be left open without affecting GSAS-II operations,
62316239
but will be closed when GSAS-II is ended if a ``parent`` window is
@@ -6264,7 +6272,7 @@ def copyURL(event):
62646272
lastWebFrame.wv.SetPage(HTML,'')
62656273
else:
62666274
lastWebFrame.wv.LoadURL(URL)
6267-
return
6275+
return dlg
62686276
except:
62696277
pass
62706278
dlg = wx.Frame(parent,size=size)

GSASII/GSASIIimgGUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ def OnClearCalib(event):
615615
G2plt.PlotExposedImage(G2frame,event=event)
616616

617617
def ResetThresholds():
618-
Imin = max(0.,np.min(G2frame.ImageZ))
619-
Imax = np.max(G2frame.ImageZ)
618+
Imin = int(max(0.,np.min(G2frame.ImageZ)))
619+
Imax = int(np.max(G2frame.ImageZ))
620620
data['range'] = [(0,Imax),[Imin,Imax]]
621621
masks['Thresholds'] = [(0,Imax),[Imin,Imax]]
622622
G2frame.slideSizer.GetChildren()[1].Window.ChangeValue(Imax) #tricky

GSASII/GSASIIpath.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,16 @@ def postURL(URL,postdict,getcookie=None,usecookie=None,
18421842
if r.status_code == 200:
18431843
if GetConfigValue('debug'): print('request OK')
18441844
page = r.text
1845+
if 'cryst.ehu.es' in URL and "currently down" in page:
1846+
# Bilbao is down. Tell user
1847+
import re
1848+
print(f"Website down? See message below:\n\n{re.sub('<.+>','',page)}")
1849+
try:
1850+
import wx
1851+
import GSASII.GSASIIctrlGUI as G2G
1852+
dlg = G2G.viewWebPage(wx.GetApp().GetMainTopWindow(),URL,HTML=page)
1853+
except:
1854+
pass
18451855
if getcookie is not None:
18461856
getcookie.update(r.cookies)
18471857
return page # success

0 commit comments

Comments
 (0)