8 usage=
'''The DNG application bundle contains two shell commands ('ost' and 'dng') that lets you use the OpenStructure command-line interpreter and dng from the terminal. If you want to use these commands, it is recommended that a symbolic link is created.
12 QDialog.__init__(self, parent)
13 self.setWindowTitle(
'Enhanced Terminal Usage')
14 self.setFixedSize(QSize(480, 300))
16 title=QLabel(
'Enhanced Terminal Usage')
24 l2.addWidget(QLabel(
'If you proceed, the link will be created in: '))
26 self.path_combo.setFixedWidth(150)
27 for path
in os.getenv(
'PATH').split(
':'):
28 exp_path=os.path.expanduser(path)
29 if os.path.exists(exp_path)
and exp_path.find(
'DNG.app')==-1:
30 self.path_combo.addItem(path)
34 ab=QPushButton(
'Create Link')
36 cb=QPushButton(
'Don\'t Create')
41 text.setWordWrap(
True)
42 QObject.connect(cb, SIGNAL(
'clicked()'), self.reject)
43 QObject.connect(ab, SIGNAL(
'clicked()'), self.accept)
45 return str(self.path_combo.currentText())
47 def _CreateLinks(bin_dir, sel_dir):
48 for bin
in (
'ost',
'dng',
'lddt',
'chemdict_tool'):
49 if os.path.exists(os.path.join(sel_dir, bin)):
50 os.unlink(os.path.join(sel_dir, bin))
51 os.system(
'ln -s "%s" "%s"' % (os.path.join(bin_dir, bin),
52 os.path.join(sel_dir, bin)))
55 Installs symlinks to the 'ost' and 'dng' command line programs into a
56 user-specified directory in the path.
61 bin_dir=os.path.join(prefix,
'bin')
62 sel_path=term_use.GetSelectedPath()
63 if not os.access(sel_path, os.W_OK):
65 if admin_rights.Acquire():
66 for bin
in (
'ost',
'dng',
'lddt',
'chemdict_tool'):
67 admin_rights.CreateLink(os.path.join(bin_dir, bin),
68 os.path.join(sel_path, bin))
69 admin_rights.Release()
71 _CreateLinks(bin_dir, sel_path)
String DLLEXPORT_OST_BASE GetPrefixPath()
get the path prefix
def InstallTerminalPrograms