Changeset 3075
- Timestamp:
- Sep 13, 2017 4:13:06 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r3056 r3075 2208 2208 :param str prompts: strings to tell use what they are inputting 2209 2209 :param str values: default input values, if any 2210 :param int size: length of the input box in pixels 2210 2211 ''' 2211 def __init__(self,parent,title,prompts,values=[] ): #,size=(200,-1)?2212 def __init__(self,parent,title,prompts,values=[],size=-1): 2212 2213 2213 2214 wx.Dialog.__init__(self,parent,wx.ID_ANY,title, … … 2217 2218 self.prompts = prompts 2218 2219 self.CenterOnParent() 2219 self.panel = wx.Panel(self)2220 2220 mainSizer = wx.BoxSizer(wx.VERTICAL) 2221 2221 promptSizer = wx.FlexGridSizer(0,2,5,5) 2222 2222 self.Indx = {} 2223 2223 for prompt,value in zip(prompts,values): 2224 promptSizer.Add(wx.StaticText(self .panel,-1,prompt),0,WACV)2225 valItem = wx.TextCtrl(self .panel,-1,value=value,style=wx.TE_PROCESS_ENTER)2224 promptSizer.Add(wx.StaticText(self,-1,prompt),0,WACV) 2225 valItem = wx.TextCtrl(self,-1,value=value,style=wx.TE_PROCESS_ENTER,size=(size,-1)) 2226 2226 self.Indx[valItem.GetId()] = prompt 2227 2227 valItem.Bind(wx.EVT_TEXT,self.newValue) 2228 promptSizer.Add(valItem, 0,WACV)2229 mainSizer.Add(promptSizer, 0)2228 promptSizer.Add(valItem,1,WACV|wx.EXPAND,1) 2229 mainSizer.Add(promptSizer,1,wx.ALL|wx.EXPAND,1) 2230 2230 btnsizer = wx.StdDialogButtonSizer() 2231 OKbtn = wx.Button(self .panel, wx.ID_OK)2231 OKbtn = wx.Button(self, wx.ID_OK) 2232 2232 OKbtn.SetDefault() 2233 2233 btnsizer.AddButton(OKbtn) 2234 btn = wx.Button(self .panel, wx.ID_CANCEL)2234 btn = wx.Button(self, wx.ID_CANCEL) 2235 2235 btnsizer.AddButton(btn) 2236 2236 btnsizer.Realize() 2237 2237 mainSizer.Add(btnsizer,0,wx.ALIGN_CENTER) 2238 self.panel.SetSizer(mainSizer) 2239 self.panel.Fit() 2238 self.SetSizer(mainSizer) 2240 2239 self.Fit() 2241 2240 … … 2758 2757 self.GBsizer.Layout() 2759 2758 self.FitInside() 2760 2759 2761 2760 ################################################################################ 2762 2761 def GetImportFile(G2frame, message, defaultDir="", defaultFile="", style=wx.OPEN, -
trunk/GSASIIdataGUI.py
r3062 r3075 126 126 #### class definitions used for main GUI 127 127 ################################################################################ 128 129 128 130 129 class MergeDialog(wx.Dialog): … … 457 456 item = parent.Append(wx.ID_PREFERENCES, text = "&Preferences") 458 457 self.Bind(wx.EVT_MENU, self.OnPreferences, item) 458 if GSASIIpath.whichsvn(): 459 item = parent.Append( 460 help='Edit proxy internet information (used for updates)', id=wx.ID_ANY, 461 kind=wx.ITEM_NORMAL,text='Edit proxy...') 462 self.Bind(wx.EVT_MENU, self.EditProxyInfo, id=item.GetId()) 459 463 if GSASIIpath.GetConfigValue('debug'): 460 464 def OnIPython(event): … … 462 466 item = parent.Append(wx.ID_ANY, text = "IPython Console") 463 467 self.Bind(wx.EVT_MENU, OnIPython, item) 468 def OnwxInspect(event): 469 import wx.lib.inspection as wxeye 470 wxeye.InspectionTool().Show() 471 item = parent.Append(wx.ID_ANY, text = "wx inspection tool") 472 self.Bind(wx.EVT_MENU, OnwxInspect, item) 473 464 474 item = parent.Append( 465 475 help='Exit from GSAS-II', id=wx.ID_ANY, … … 1962 1972 dlg.Destroy() 1963 1973 1974 def EditProxyInfo(self,event): 1975 '''Edit the proxy information used by subversion 1976 ''' 1977 h,p = host,port = GSASIIpath.getsvnProxy() 1978 dlg = G2G.MultiStringDialog(self,'Enter proxy values', 1979 ['Proxy address','proxy port'], 1980 [host,port],size=300) 1981 #dlg.SetSize((300,-1)) 1982 if dlg.Show(): 1983 h,p = dlg.GetValues() 1984 dlg.Destroy() 1985 if h != host or p != port: 1986 proxyinfo = os.path.join(GSASIIpath.path2GSAS2,"proxyinfo.txt") 1987 GSASIIpath.setsvnProxy(h,p) 1988 if not h.strip(): 1989 os.remove(proxyinfo) 1990 return 1991 try: 1992 fp = open(proxyinfo,'w') 1993 fp.write(h.strip()+'\n') 1994 fp.write(p.strip()+'\n') 1995 fp.close() 1996 except Exception as err: 1997 print('Error writing file {}:\n{}'.format(proxyinfo,err)) 1964 1998 def _Add_ImportMenu_smallangle(self,parent): 1965 1999 '''configure the Small Angle Data menus accord to the readers found in _init_Imports -
trunk/GSASIIpath.py
r3025 r3075 120 120 svnLocCache = None 121 121 'Cached location of svn to avoid multiple searches for it' 122 122 def getsvnProxy(): 123 '''Loads a proxy for subversion from the file created by bootstrap.py 124 ''' 125 proxyinfo = os.path.join(path2GSAS2,"proxyinfo.txt") 126 if os.path.exists(proxyinfo): 127 global proxycmds 128 proxycmds = [] 129 fp = open(proxyinfo,'r') 130 host = fp.readline().strip() 131 port = fp.readline().strip() 132 fp.close() 133 setsvnProxy(host,port) 134 if not host.strip(): return '','' 135 return host,port 136 137 def setsvnProxy(host,port): 138 '''Sets the svn commands needed to use a proxy 139 ''' 140 global proxycmds 141 proxycmds = [] 142 host = host.strip() 143 port = port.strip() 144 if not host.strip(): return 145 proxycmds.append('--config-option') 146 proxycmds.append('servers:global:http-proxy-host='+host) 147 proxycmds.append('--config-option') 148 proxycmds.append('servers:global:http-proxy-port='+port) 149 123 150 def whichsvn(): 124 151 '''Returns a path to the subversion exe file, if any is found. … … 136 163 svnprog = 'svn' 137 164 if sys.platform.startswith('win'): svnprog += '.exe' 138 gsaspath = os.path.split(__file__)[0] 139 # check for a proxy 140 proxyinfo = os.path.join(gsaspath,"proxyinfo.txt") 141 if os.path.exists(proxyinfo): 142 global proxycmds 143 proxycmds = [] 144 fp = open(proxyinfo,'r') 145 host = fp.readline().strip() 146 port = fp.readline().strip() 147 fp.close() 148 proxycmds.append('--config-option') 149 proxycmds.append('servers:global:http-proxy-host='+host) 150 proxycmds.append('--config-option') 151 proxycmds.append('servers:global:http-proxy-port='+port) 165 host,port = getsvnProxy() 166 if GetConfigValue('debug'): 167 print('Using proxy host {} port {}'.format(host,port)) 152 168 # add likely places to find subversion when installed with GSAS-II 153 169 pathlist = os.environ["PATH"].split(os.pathsep) 154 170 pathlist.append(os.path.split(sys.executable)[0]) 155 pathlist.append( gsaspath)171 pathlist.append(path2GSAS2) 156 172 for rpt in ('..','bin'),('..','Library','bin'),('svn','bin'),('svn',),('.'): 157 pt = os.path.normpath(os.path.join( gsaspath,*rpt))173 pt = os.path.normpath(os.path.join(path2GSAS2,*rpt)) 158 174 if os.path.exists(pt): 159 175 pathlist.insert(0,pt)
Note: See TracChangeset
for help on using the changeset viewer.