Skip to content

Commit aa18a04

Browse files
committed
address #187 -- export CIF
1 parent 4d1b628 commit aa18a04

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

GSASII/exports/G2export_CIF.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
import copy
1313
import re
1414
interactive = False
15+
G2G = None # used in Project export
1516
try:
1617
# TODO: code that calls wx should be hidden in GUI modules that are imported only when needed
1718
import wx
1819
import wx.lib.scrolledpanel as wxscroll
1920
import wx.lib.resizewidget as rw
2021
interactive = True
2122
except ImportError:
22-
G2G = None # used in Project export
23+
wx = None
2324
# Avoid wx dependency for Scriptable
2425
class Placeholder(object):
2526
def __init__(self):
@@ -4679,9 +4680,14 @@ def Exporter(self,event=None,seqData=None,Controls=None):
46794680
#print('reloaded GSASIImapvars')
46804681
#### end debug stuff ##############################
46814682

4682-
if G2G is None:
4683+
if wx is None:
46834684
print('Unable to export without GUI access')
46844685
return
4686+
try:
4687+
from .. import GSASIIctrlGUI as G2G
4688+
except:
4689+
print('Unable to export without GSASIIctrlGUI access')
4690+
return
46854691
try:
46864692
import CifFile as cif # PyCifRW from James Hester as a package
46874693
except ImportError:
@@ -4690,7 +4696,6 @@ def Exporter(self,event=None,seqData=None,Controls=None):
46904696
cif
46914697
except ImportError:
46924698
msg = 'The PyCifRW package is not installed. CIF templates cannot be accessed. Created CIFs will be incomplete'
4693-
from .. import GSASIIctrlGUI as G2G
46944699
G2G.G2MessageBox(self.G2frame,msg,'no PyCifRW')
46954700
self.CIFname = ''
46964701
self.seqData = seqData

0 commit comments

Comments
 (0)