|
31 | 31 | import random as ran |
32 | 32 | import numpy as np |
33 | 33 |
|
34 | | -import matplotlib as mpl |
| 34 | +#import matplotlib as mpl |
35 | 35 | try: |
36 | 36 | from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas |
37 | 37 | except ImportError: |
|
47 | 47 | from . import GSASIIpwd as G2pwd |
48 | 48 | from . import GSASIIlattice as G2lat |
49 | 49 | from . import GSASIImath as G2mth |
50 | | -from . import GSASIIstrMain as G2stMn |
| 50 | +#from . import GSASIIstrMain as G2stMn |
51 | 51 | from . import GSASIImiscGUI as G2IO |
52 | 52 | from .tutorialIndex import tutorialIndex |
53 | 53 | if sys.version_info[0] >= 3: |
@@ -5042,7 +5042,7 @@ def SetContents(self,parent): |
5042 | 5042 | if parent.hisNum != '*' and name.split(':')[1] != parent.hisNum: continue |
5043 | 5043 | if (parent.varName != ' ') and (parent.varName not in name): continue |
5044 | 5044 | self.varList.append(name) |
5045 | | - oldlen = self.GetItemCount() |
| 5045 | + #oldlen = self.GetItemCount() |
5046 | 5046 | self.SetItemCount(len(self.varList)) |
5047 | 5047 |
|
5048 | 5048 | def OnRowSelected(self, event, row=None): |
@@ -6025,7 +6025,7 @@ def copy2clip(event): |
6025 | 6025 | msg += f"\n\n * For {key} use cite:\n" |
6026 | 6026 | msg += GetCite(key,wrap=95,indent=6) |
6027 | 6027 | msg += '\n\nNote that your citations are one of the strongest ways you can say thank you to the\nscientists who make their software available to you.' |
6028 | | - res = ShowScrolledInfo(parent,msg,header='Please Cite', |
| 6028 | + ShowScrolledInfo(parent,msg,header='Please Cite', |
6029 | 6029 | buttonlist=[ |
6030 | 6030 | ('Close', lambda event: event.GetEventObject().GetParent().EndModal(wx.ID_OK)), |
6031 | 6031 | ('Copy to clipboard', copy2clip), |
@@ -6283,7 +6283,7 @@ def copyURL(event): |
6283 | 6283 | # place HTML title into window title |
6284 | 6284 | dlg.wv.Bind(wx.EVT_UPDATE_UI, lambda event: |
6285 | 6285 | dlg.SetTitle(dlg.wv.GetCurrentTitle())) |
6286 | | - lastWebView = dlg.wv |
| 6286 | + #lastWebView = dlg.wv |
6287 | 6287 | sizer.Add(dlg.wv,1,wx.EXPAND) |
6288 | 6288 | # row of buttons & URL label on bottom of window |
6289 | 6289 | bsizer=wx.BoxSizer(wx.HORIZONTAL) |
@@ -7349,7 +7349,7 @@ class gitVersionSelector(wx.Dialog): |
7349 | 7349 | from a git repository |
7350 | 7350 | ''' |
7351 | 7351 | def __init__(self,parent=None): |
7352 | | - import git |
| 7352 | + #import git |
7353 | 7353 | self.g2repo = GSASIIpath.openGitRepo(path2GSAS2) |
7354 | 7354 | self.githistory = GSASIIpath.gitHistory('hash',self.g2repo) |
7355 | 7355 | # patch Feb 2024: don't allow access to versions that are too old |
@@ -7492,7 +7492,7 @@ def docCommit(self,commit): |
7492 | 7492 |
|
7493 | 7493 | :returns: a multi-line string |
7494 | 7494 | ''' |
7495 | | - import datetime |
| 7495 | + #import datetime |
7496 | 7496 | fmtdate = lambda c:"{:%d-%b-%Y %H:%M}".format(c.committed_datetime) |
7497 | 7497 | commit = self.g2repo.commit(commit) # converts a hash, if supplied |
7498 | 7498 | msg = f'git {commit.hexsha[:10]} from {fmtdate(commit)}' |
@@ -9397,6 +9397,15 @@ def askQuestion(parent,question,title): |
9397 | 9397 | dlg.Destroy() |
9398 | 9398 | return ans |
9399 | 9399 |
|
| 9400 | +def haveGUI(): |
| 9401 | + '''Test if there is a GUI that can be accessed |
| 9402 | + :returns: True if a GUI is available |
| 9403 | + ''' |
| 9404 | + try: |
| 9405 | + return wx.App.IsMainLoopRunning() |
| 9406 | + except: |
| 9407 | + return False |
| 9408 | + |
9400 | 9409 | #=========================================================================== |
9401 | 9410 | def gitFetch(G2frame): |
9402 | 9411 | wx.BeginBusyCursor() |
@@ -9832,7 +9841,7 @@ def gitSwitchMaster2Main(): |
9832 | 9841 |
|
9833 | 9842 | See web page GSASII.github.io for information on how to install GSAS-II. |
9834 | 9843 | ''' |
9835 | | - res = ShowScrolledInfo(G2frame,msg,header='Please Note', |
| 9844 | + ShowScrolledInfo(G2frame,msg,header='Please Note', |
9836 | 9845 | height=250) |
9837 | 9846 | return |
9838 | 9847 |
|
@@ -9941,13 +9950,13 @@ def gitSwitchMaster2Main(): |
9941 | 9950 | if script and sys.platform.startswith('darwin'): |
9942 | 9951 | print(f'running {script}') |
9943 | 9952 | import subprocess |
9944 | | - out = subprocess.run([sys.executable,script],cwd=GSASIIpath.path2GSAS2) |
| 9953 | + subprocess.run([sys.executable,script],cwd=GSASIIpath.path2GSAS2) |
9945 | 9954 | # On windows make a batch file with hard-coded paths to Python and GSAS-II |
9946 | 9955 | elif script and sys.platform.startswith('win'): |
9947 | 9956 | script = os.path.normpath(os.path.join(GSASIIpath.path2GSAS2,'install',s)) |
9948 | 9957 | print(f'running {script!r}') |
9949 | 9958 | import subprocess |
9950 | | - out = subprocess.run([sys.executable,script],cwd=GSASIIpath.path2GSAS2) |
| 9959 | + subprocess.run([sys.executable,script],cwd=GSASIIpath.path2GSAS2) |
9951 | 9960 | # On linux, make a desktop icon with hard-coded paths to Python and GSAS-II |
9952 | 9961 | elif script: |
9953 | 9962 | sys.argv = [script] |
|
0 commit comments