limatix 1.2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. limatix/__init__.py +45 -0
  2. limatix/_version.py +24 -0
  3. limatix/bin/__init__.py +1 -0
  4. limatix/bin/datacollect2.py +418 -0
  5. limatix/bin/dc_checklist.py +245 -0
  6. limatix/bin/dc_chx2chf.py +88 -0
  7. limatix/bin/dc_getpath.py +33 -0
  8. limatix/bin/dc_glade.py +60 -0
  9. limatix/bin/dc_gui.py +98 -0
  10. limatix/bin/dc_paramdb2.py +333 -0
  11. limatix/bin/dc_ricohphoto.py +185 -0
  12. limatix/bin/dc_xlg2dpd.py +224 -0
  13. limatix/bin/limatix_git.py +584 -0
  14. limatix/bin/processtrak.py +389 -0
  15. limatix/bin/pt_checkprovenance.py +155 -0
  16. limatix/bin/pt_cleanup.py +639 -0
  17. limatix/bin/thermal2limatix.py +343 -0
  18. limatix/canonicalize_path/.gitignore +2 -0
  19. limatix/canonicalize_path/.gitrepo +12 -0
  20. limatix/canonicalize_path/Makefile +22 -0
  21. limatix/canonicalize_path/__init__.py +5 -0
  22. limatix/canonicalize_path/canonical_paths.conf.example +16 -0
  23. limatix/canonicalize_path/canonicalize_path/__init__.py +61 -0
  24. limatix/canonicalize_path/canonicalize_path/canonical_paths.conf +16 -0
  25. limatix/canonicalize_path/canonicalize_path/canonical_url.py +1728 -0
  26. limatix/canonicalize_path/canonicalize_path/canonicalize_path_module.py +214 -0
  27. limatix/canonicalize_path/canonicalize_path/canonicalize_xpath_module.py +707 -0
  28. limatix/canonicalize_path/canonicalize_path/tag_index_paths.conf +21 -0
  29. limatix/canonicalize_path/demos/canonical_url_test.py +41 -0
  30. limatix/canonicalize_path/setup.py +101 -0
  31. limatix/canonicalize_path/tag_index_paths.conf.example +21 -0
  32. limatix/checklist.glade +327 -0
  33. limatix/checklist.py +2979 -0
  34. limatix/checklistdb.py +1101 -0
  35. limatix/checklistdbwin.py +814 -0
  36. limatix/dbus_camera.py +222 -0
  37. limatix/dc2_misc.py +377 -0
  38. limatix/dc_dbus_barcode.py +124 -0
  39. limatix/dc_dbus_paramclient.py +146 -0
  40. limatix/dc_dbus_paramserver.py +326 -0
  41. limatix/dc_gtksupp.py +181 -0
  42. limatix/dc_lxml_treesync/.gitignore +2 -0
  43. limatix/dc_lxml_treesync/.gitrepo +12 -0
  44. limatix/dc_lxml_treesync/INSTALL.txt +10 -0
  45. limatix/dc_lxml_treesync/Makefile +19 -0
  46. limatix/dc_lxml_treesync/README.txt +81 -0
  47. limatix/dc_lxml_treesync/__init__.py +0 -0
  48. limatix/dc_lxml_treesync/dc_lxml_treesync.py +943 -0
  49. limatix/dc_lxml_treesync/setup.py +11 -0
  50. limatix/dc_lxml_treesync/treesync_test.py +38 -0
  51. limatix/dc_lxml_treesync/treesync_test2.py +45 -0
  52. limatix/dc_unitscalc.py +302 -0
  53. limatix/dc_value.py +2586 -0
  54. limatix/dc_xmlgrab2.py +676 -0
  55. limatix/dcp_status.py +7 -0
  56. limatix/dg_io.py +1081 -0
  57. limatix/explogwin.glade +522 -0
  58. limatix/explogwindow.py +1668 -0
  59. limatix/genericmethodwrapper.py +235 -0
  60. limatix/limatix_checklists/testlist.chx +65 -0
  61. limatix/limatix_checklists/testlistimg.png +0 -0
  62. limatix/limatix_checklists/thermalconductivity_meas.chx +47 -0
  63. limatix/limatix_checklists/thermalconductivity_prep.chx +41 -0
  64. limatix/limatix_conf/imports.dcc +21 -0
  65. limatix/limatix_conf/silentstamina_demo.glade +159 -0
  66. limatix/limatix_conf/thermalconductivity.dcc +21 -0
  67. limatix/limatix_xslt/Makefile +46 -0
  68. limatix/limatix_xslt/spreadsheet_like_datacollect.xsl +55 -0
  69. limatix/limatix_xslt/viewprovenance.xsl +195 -0
  70. limatix/lm_units.py +941 -0
  71. limatix/paramdb2.py +1888 -0
  72. limatix/paramdb2_editor.py +271 -0
  73. limatix/paramdb2_wrapper.py +186 -0
  74. limatix/paramdbfile.py +398 -0
  75. limatix/processtrak_cleanup.py +429 -0
  76. limatix/processtrak_common.py +1306 -0
  77. limatix/processtrak_procstep.py +2525 -0
  78. limatix/processtrak_prxdoc.py +50 -0
  79. limatix/processtrak_status.py +384 -0
  80. limatix/processtrak_stdiocapture.py +72 -0
  81. limatix/processtrak_stepparam.py +450 -0
  82. limatix/provenance.py +1578 -0
  83. limatix/provenance.xsd +263 -0
  84. limatix/pt_steps/limatix_assignelements.py +37 -0
  85. limatix/pt_steps/limatix_create_order.py +17 -0
  86. limatix/pt_steps/limatix_create_subelement.py +26 -0
  87. limatix/pt_steps/limatix_writespreadsheet.py +605 -0
  88. limatix/py26counter.py +194 -0
  89. limatix/readablehash.py +59 -0
  90. limatix/ricohcamera.glade +69 -0
  91. limatix/ricohcamera.py +388 -0
  92. limatix/ricohphoto.glade +232 -0
  93. limatix/standalone_checklist.py +226 -0
  94. limatix/steps/__init__.py +1 -0
  95. limatix/steps/buttonreadoutstep.glade +51 -0
  96. limatix/steps/buttonreadoutstep.py +223 -0
  97. limatix/steps/buttonresetvaluesstep.glade +41 -0
  98. limatix/steps/buttonresetvaluesstep.py +324 -0
  99. limatix/steps/buttonstep.glade +41 -0
  100. limatix/steps/buttonstep.py +227 -0
  101. limatix/steps/buttontextareastep.glade +51 -0
  102. limatix/steps/buttontextareastep.py +143 -0
  103. limatix/steps/dc_imagereadoutstep.glade +28 -0
  104. limatix/steps/dc_imagereadoutstep.py +271 -0
  105. limatix/steps/dc_paramstep.glade +29 -0
  106. limatix/steps/dc_paramstep.py +277 -0
  107. limatix/steps/dc_selectableparamstep.glade +29 -0
  108. limatix/steps/dc_selectableparamstep.py +265 -0
  109. limatix/steps/hrefbuttonstep.py +401 -0
  110. limatix/steps/runcheckliststep.glade +57 -0
  111. limatix/steps/runcheckliststep.py +976 -0
  112. limatix/steps/rundatacollectstep.glade +62 -0
  113. limatix/steps/rundatacollectstep.py +734 -0
  114. limatix/steps/runmatlabscriptstep.py +81 -0
  115. limatix/steps/runscriptstep.py +672 -0
  116. limatix/steps/savebuttonstep.py +492 -0
  117. limatix/steps/savemeasurementstep.glade +41 -0
  118. limatix/steps/savemeasurementstep.py +146 -0
  119. limatix/steps/specimendisplaystep.glade +143 -0
  120. limatix/steps/specimendisplaystep.py +244 -0
  121. limatix/steps/testadjustparamstep.py +41 -0
  122. limatix/steps/textentrystep.glade +30 -0
  123. limatix/steps/textentrystep.py +295 -0
  124. limatix/steps/textgraphicstep.glade +30 -0
  125. limatix/steps/textgraphicstep.py +184 -0
  126. limatix/steps/textstep.py +72 -0
  127. limatix/steptemplate.glade +53 -0
  128. limatix/steptemplate.py +170 -0
  129. limatix/testviewautoexp +67 -0
  130. limatix/testxmlgrab.py +18 -0
  131. limatix/threadserializedwrapper.py +259 -0
  132. limatix/timestamp.py +96 -0
  133. limatix/units.py +722 -0
  134. limatix/viewautoexp.py +148 -0
  135. limatix/widgets/__init__.py +1 -0
  136. limatix/widgets/adjustparamreadout.py +400 -0
  137. limatix/widgets/booleanparamreadout.py +355 -0
  138. limatix/widgets/dc_wraplabel.py +111 -0
  139. limatix/widgets/excitationparam.glade +88 -0
  140. limatix/widgets/excitationparam.py +403 -0
  141. limatix/widgets/glade_catalogs/__init__.py +0 -0
  142. limatix/widgets/glade_catalogs/dc_catalog.xml +197 -0
  143. limatix/widgets/glade_catalogs/dc_widgets.py +42 -0
  144. limatix/widgets/glade_catalogs/dg_gui_widgettest.py +73 -0
  145. limatix/widgets/glade_catalogs/dg_gui_widgettest_catalog.xml +33 -0
  146. limatix/widgets/how_to_import.txt +8 -0
  147. limatix/widgets/imagereadout.py +283 -0
  148. limatix/widgets/labelled_adjustparamreadout.py +123 -0
  149. limatix/widgets/labelled_selectableparamreadout.py +105 -0
  150. limatix/widgets/paragraphparam.py +470 -0
  151. limatix/widgets/selectableparamreadout.py +525 -0
  152. limatix/xmldoc.py +4473 -0
  153. limatix/xmlexplog.py +172 -0
  154. limatix-1.2.6.dist-info/METADATA +89 -0
  155. limatix-1.2.6.dist-info/RECORD +159 -0
  156. limatix-1.2.6.dist-info/WHEEL +5 -0
  157. limatix-1.2.6.dist-info/entry_points.txt +55 -0
  158. limatix-1.2.6.dist-info/licenses/COPYING.txt +57 -0
  159. limatix-1.2.6.dist-info/top_level.txt +1 -0
limatix/__init__.py ADDED
@@ -0,0 +1,45 @@
1
+ import sys
2
+ import os
3
+ import os.path
4
+
5
+ try:
6
+ # py2.x
7
+ from urllib import pathname2url
8
+ pass
9
+ except ImportError:
10
+ # py3.x
11
+ from urllib.request import pathname2url
12
+ pass
13
+
14
+
15
+ class dummy(object):
16
+ pass
17
+
18
+
19
+ pkgpath = sys.modules[dummy.__module__].__file__
20
+ pkgdir=os.path.split(pkgpath)[0]
21
+
22
+ def getptstepurlpath():
23
+
24
+ return [ pathname2url(os.path.join(pkgdir,"pt_steps")) ]
25
+
26
+ def getchecklisturlpath():
27
+
28
+ return [ pathname2url(os.path.join(pkgdir,"limatix_checklists")) ]
29
+
30
+
31
+ def getconfigurlpath():
32
+
33
+ return [ pathname2url(os.path.join(pkgdir,"limatix_conf")) ]
34
+
35
+
36
+ versionpath = os.path.join(pkgdir,"version.txt")
37
+ if os.path.exists(versionpath):
38
+ versionfh = open(versionpath,"r")
39
+ __version__=versionfh.read().strip()
40
+ versionfh.close()
41
+ pass
42
+ else:
43
+ __version__="UNINSTALLED"
44
+ pass
45
+
limatix/_version.py ADDED
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '1.2.6'
22
+ __version_tuple__ = version_tuple = (1, 2, 6)
23
+
24
+ __commit_id__ = commit_id = 'g986511edd'
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,418 @@
1
+ #! /usr/bin/env python
2
+
3
+ import sys
4
+ import os
5
+ import os.path
6
+ import string
7
+ import datetime
8
+ import socket
9
+
10
+ try:
11
+ # py2.x
12
+ from urllib import pathname2url
13
+ from urllib import url2pathname
14
+ from urllib import quote
15
+ from urllib import unquote
16
+ pass
17
+ except ImportError:
18
+ # py3.x
19
+ from urllib.request import pathname2url
20
+ from urllib.request import url2pathname
21
+ from urllib.parse import quote
22
+ from urllib.parse import unquote
23
+ pass
24
+
25
+
26
+ if "--gtk3" in sys.argv or sys.version_info[0] >= 3: # gtk3
27
+ import gi
28
+ gi.require_version('Gtk','3.0')
29
+ from gi.repository import Gtk as gtk
30
+ from gi.repository import GObject as gobject
31
+ pass
32
+ else : # gtk2
33
+ import gobject
34
+ import gtk
35
+ pass
36
+
37
+ import subprocess
38
+
39
+ from limatix import lm_units
40
+ lm_units.units_config("insert_basic_units")
41
+
42
+
43
+
44
+ class dummy(object):
45
+ pass
46
+
47
+ ## trace symbolic link to find installed directory
48
+ #thisfile=sys.modules[dummy.__module__].__file__
49
+ #if os.path.islink(thisfile):
50
+ # installedfile=os.readlink(thisfile)
51
+ # if not os.path.isabs(installedfile):
52
+ # installedfile=os.path.join(os.path.dirname(thisfile),installedfile)
53
+ # pass
54
+ # pass
55
+ #else:
56
+ # installedfile=thisfile
57
+ # pass
58
+
59
+ #installeddir=os.path.dirname(installedfile)
60
+
61
+ #if os.path.exists(os.path.join(installeddir,"../lib/checklist.py")):
62
+ # installeddir=os.path.join(installeddir,"../")
63
+ # pass
64
+ #elif os.path.exists(os.path.join(installeddir,"../gui2/lib/checklist.py")):
65
+ # installeddir=os.path.join(installeddir,"../gui2")
66
+ # pass
67
+
68
+ #installedfile='/usr/local/dataguzzler-2.0.0-beta23-devel/bin/datacollect2'
69
+ #installeddir='/usr/local/dataguzzler-2.0.0-beta23-devel/gui2'
70
+
71
+ #sys.path.append(installeddir)
72
+ #sys.path.append(os.path.join(installeddir,"lib/"))
73
+ #sys.path.append(os.path.join(installeddir,"steps/"))
74
+
75
+
76
+ from limatix.dc_value import numericunitsvalue as numericunitsv
77
+ from limatix.dc_value import stringvalue as stringv
78
+ from limatix.dc_value import hrefvalue as hrefv
79
+ from limatix.dc_value import integervalue as integerv
80
+ from limatix.dc_value import photosvalue as photosv
81
+ from limatix.dc_value import datesetvalue as datesetv
82
+ from limatix.dc_value import accumulatingdatesetvalue as accumulatingdatesetv
83
+ from limatix.dc_value import xmltreevalue as xmltreev
84
+
85
+ from limatix.dc_dbus_barcode import dc_dbus_barcode
86
+
87
+ #import dg_io
88
+ import limatix.paramdb2 as pdb
89
+ from limatix import paramdbfile
90
+ from limatix import dc2_misc
91
+
92
+ from limatix import checklist
93
+
94
+ from limatix.dc_gtksupp import build_from_file
95
+ from limatix.dc_gtksupp import dc_initialize_widgets
96
+ from limatix.dc_gtksupp import import_widgets
97
+ from limatix.dc_gtksupp import guistate as create_guistate
98
+
99
+ from limatix import explogwindow
100
+
101
+ from limatix import xmldoc
102
+ from limatix import xmlexplog
103
+ from limatix import checklistdb
104
+
105
+ # from dc_dbus_paramserver import dc_dbus_paramserver
106
+
107
+
108
+ # Plan --
109
+ # 1. Build global measnum handler, assign each checklist
110
+ # that either has a save measurement step or
111
+ # the done_is_save_measurement flag a measnum on open.
112
+ # 2. Build "expanding date" field to accumulate dates.
113
+ # 3. Add nospecimen <specimen> attribute for checklists
114
+ # that removes the <specimen> field.
115
+ # 4. Add step that can be used for both vibrometer settings
116
+ # 5. Add step that clears a set of parameters
117
+ # 6. Make Save DGS or Save Settings turn button green after execution
118
+
119
+ def main(args=None):
120
+ if args is None:
121
+ args=sys.argv
122
+ pass
123
+
124
+ SingleSpecimen=None
125
+ positionals=[]
126
+ cmdline_guis=[]
127
+ cmdline_plans=[]
128
+ cmdline_checklists=[]
129
+ cmdline_configfiles=[]
130
+ dpdfiles=[]
131
+ explogfile=None
132
+ newlog=False
133
+ parentchecklisturl=None
134
+
135
+ argc=1
136
+
137
+ while argc < len(args):
138
+ arg=args[argc]
139
+
140
+ if arg=="-m":
141
+ SingleSpecimen=False
142
+ pass
143
+ elif arg=="-s":
144
+ SingleSpecimen=True
145
+ pass
146
+ elif arg=="-f":
147
+ argc+=1
148
+ cmdline_configfiles.append(args[argc])
149
+ pass
150
+ elif arg=="-g":
151
+ argc+=1
152
+ cmdline_guis.append(args[argc])
153
+ pass
154
+ elif arg=="-c":
155
+ argc+=1
156
+ cmdline_checklists.append(args[argc])
157
+ pass
158
+ elif arg=="-p":
159
+ argc+=1
160
+ cmdline_plans.append(args[argc])
161
+ pass
162
+ elif arg=='-n':
163
+ newlog=True
164
+ pass
165
+ elif arg=="-d":
166
+ argc+=1
167
+ dpdfiles.append(args[argc])
168
+ pass
169
+ elif arg=='--gtk3':
170
+ # handled at imports, above
171
+ pass
172
+ elif arg=='--parent':
173
+ # get relative url from xlg file to parent checklist
174
+ argc+=1
175
+ parentchecklisturl=args[argc]
176
+ pass
177
+ elif arg=='-h' or arg=="--help":
178
+ print ("""Usage: %s [-s|-m] [-f <config.dcc>] [-a] <explog.xlg> [-g gui.glade] [-c checklist.chx] [-p plan.plx] ...
179
+
180
+ Flags:
181
+ -s Single specimen mode
182
+ -m Multiple specimen mode
183
+ -n Create new experiment log
184
+ -f <config.dcc> Open this config file (multiple OK)
185
+ -g <gui.glade> Open this gui (multiple OK)
186
+ -c <checklist.chx> Open this checklist (multiple OK)
187
+ -p <plan.plx> Open this plan (multiple OK)
188
+ -d <params.dpd> Open this parameter file (multiple OK)
189
+ --gtk3
190
+ """ % (args[0]))
191
+ sys.exit(0)
192
+ pass
193
+ elif arg[0]=='-':
194
+ raise ValueError("Unknown command line switch %s" % (arg))
195
+ else :
196
+ positionals.append(arg)
197
+ pass
198
+ argc+=1
199
+ pass
200
+
201
+ if len(positionals) > 1:
202
+ raise ValueError("Too many positional parameters (see -h for command line help")
203
+
204
+ #if len(positionals) >= 1:
205
+ # if os.path.splitext(positionals[0])[1] != ".dcc":
206
+ # raise ValueError("First positional parameter %s must be a .dcc file (se#e -h for command line help)" % (positionals[0]))
207
+ # configfile=positionals[0]
208
+ # pass
209
+
210
+ if len(positionals) == 1:
211
+ if os.path.splitext(positionals[0])[1] != ".xlg":
212
+ raise ValueError("First positional parameter %s must be a .xlg file (see -h for command line help)" % (positionals[0]))
213
+ explogfile=positionals[0]
214
+ pass
215
+
216
+
217
+
218
+ if "gobject" in sys.modules: # only for GTK2
219
+ gobject.threads_init()
220
+ pass
221
+
222
+ import_widgets()
223
+
224
+
225
+ # insert config from dpd files before all other configs.
226
+ configfiles=[]
227
+ guis=[]
228
+ checklists=[]
229
+ plans=[]
230
+ paramupdates=[]
231
+
232
+ for dpdfile in dpdfiles:
233
+ (dpdconfigfiles,dpdguis,dpdchxfiles,dpdplans,dpdexplog,dpdparamupdates,dpdSingleSpecimen)=paramdbfile.load_params(dpdfile)
234
+ configfiles.extend(dpdconfigfiles)
235
+ guis.extend(dpdguis)
236
+ checklists.extend(dpdchxfiles)
237
+ plans.extend(dpdplans)
238
+ paramupdates.append(dpdparamupdates)
239
+
240
+ if explogfile is None and dpdexplog is not None:
241
+ explogfile=dpdexplog
242
+ pass
243
+ elif explogfile is not None and dpdexplog is not None:
244
+ raise ValueError("Multiple experiment logs specified: %s as well as %s in %s" % (explogfile,dpdexplog,dpdfile))
245
+
246
+ if SingleSpecimen is None and dpdSingleSpecimen is not None:
247
+ SingleSpecimen=dpdSingleSpecimen
248
+ pass
249
+ elif SingleSpecimen is not None and dpdSingleSpecimen is not None:
250
+ raise ValueError("Single/multiple specimen mode specified multiple times.")
251
+
252
+ pass
253
+
254
+
255
+ configfiles.extend(cmdline_configfiles)
256
+ guis.extend(cmdline_guis)
257
+ checklists.extend(cmdline_checklists)
258
+ plans.extend(cmdline_plans)
259
+
260
+
261
+
262
+
263
+
264
+ iohandlers={} #dg_io.io()
265
+
266
+ paramdb=pdb.paramdb(iohandlers)
267
+ #if SingleSpecimen is None: # not already set on command line
268
+ # SingleSpecimen chooser moved to explogwindow.py
269
+
270
+
271
+ # define parameters
272
+
273
+ # parameters that are supposed to go in the summary need to have an adddoc() call in explogwindow.syncexplog. Also see "not synced" in paramdbfile.py
274
+ # The adddoc() call can also be used to supply a default value which will be
275
+ # set only if not read in from the file.
276
+ # and a corresponding remdoc call in explogwindow.unsyncexplog
277
+
278
+ # paramdb.addparam("clinfo",stringv)
279
+ paramdb.addparam("hostname",stringv,build=lambda param: xmldoc.synced(param),non_settable=True)
280
+ paramdb.addparam("specimen",stringv,build=lambda param: xmldoc.synced(param)) # reset_with_meas_record=not SingleSpecimen)... MonkeyPatched later
281
+ paramdb.addparam("perfby",stringv,build=lambda param: xmldoc.synced(param))
282
+ # paramdb.addparam("date",stringv,build=lambda param: xmldoc.synced(param))
283
+ #paramdb.addparam("date",datesetv,build=lambda param: xmldoc.synced_accumulating_dates(param))
284
+ paramdb.addparam("date",accumulatingdatesetv,build=lambda param: xmldoc.synced(param))
285
+ paramdb.addparam("checklists",xmltreev,build=lambda param: xmldoc.synced(param,tag_index_paths_override={"{http://limatix.org/datacollect}checklist":"@{http://www.w3.org/1999/xlink}href"}),hide_from_meas=True)
286
+ checklistdb.register_paramdb(paramdb,"checklists",None,False)
287
+
288
+ paramdb.addparam("plans",xmltreev,build=lambda param: xmldoc.synced(param,tag_index_paths_override={"{http://limatix.org/datacollect}checklist":"@{http://www.w3.org/1999/xlink}href"}),hide_from_meas=True)
289
+ checklistdb.register_paramdb(paramdb,"plans",None,True)
290
+
291
+
292
+ paramdb.addparam("expnotes",stringv,build=lambda param: xmldoc.synced(param),hide_from_meas=True)
293
+ paramdb.addparam("goal",stringv,build=lambda param: xmldoc.synced(param),hide_from_meas=True)
294
+
295
+ # "dest" is the contextdir for XML data and hrefs within paramdb
296
+ # EXCEPT when paramdb is being written out to the experiment log.
297
+ # Will be auto-fixedup because the dcvalue xmlrepr methods will
298
+ # convert their context to that of the file they are writing.
299
+ paramdb.addparam("dest",hrefv,build=lambda param: xmldoc.synced(param),hide_from_meas=True)
300
+ paramdb.addparam("explogname",stringv,hide_from_meas=True)
301
+
302
+ #paramdb.addparam("nextmeasnum",integerv,build=lambda param: xmldoc.synced(param),hide_from_meas=True)
303
+ paramdb.addparam("measnum",integerv,build=lambda param: xmldoc.synced(param),hide_from_meas=True)
304
+ paramdb.addparam("expphotos",photosv,build=lambda param: xmldoc.synced(param),hide_from_meas=True)
305
+ paramdb.addparam("measphotos",photosv,reset_with_meas_record=True)
306
+ paramdb.addparam("notes",stringv,build=lambda param: xmldoc.synced(param)) # notes is shared between (the measurement checklist(s) that have done_is_save_measurement set or have a save measurement step) and the experiment log (although notes is not written directly to the experiment log except in a save measurement step)
307
+
308
+ # print "Notes value: ", str(type(str(paramdb["notes"].dcvalue)))
309
+
310
+ paramdb.addparam("measchecklist",hrefv,reset_with_meas_record=True)
311
+
312
+
313
+ # auto-set date
314
+ if paramdb["date"].dcvalue.isblank():
315
+ curdate=datetime.date.today()
316
+ paramdb["date"].requestvalstr_sync(curdate.isoformat())
317
+ pass
318
+
319
+ # auto-set hostname
320
+ dc2_misc.set_hostname(paramdb)
321
+ # print str(paramdb["date"].dcvalue)
322
+
323
+ # Connect to dbus (barcode reader)
324
+ dbuslink=dc_dbus_barcode(paramdb)
325
+
326
+
327
+
328
+ explogwin=explogwindow.explogwindow(os.path.join(os.path.split(explogwindow.__file__)[0],"explogwin.glade"),paramdb,SingleSpecimen)
329
+
330
+ ## Create dbus paramserver
331
+ #paramserver=dc_dbus_paramserver(paramdb,explogwin.checklists)
332
+ # paramserver is now created within explogwin.createparamserver() and stored as a member of explogwin
333
+
334
+
335
+ guistate=create_guistate(iohandlers,paramdb) # can add search directories as additional parameters here [os.path.split(fname)[0]])
336
+
337
+
338
+ explogwin.dc_gui_init(guistate)
339
+
340
+ confighrefs=[ hrefv(pathname2url(configfile),contexthref=hrefv("./")) for configfile in configfiles ]
341
+
342
+ if len(confighrefs)==0:
343
+ confighrefs=None
344
+ pass
345
+
346
+ if explogfile is not None and newlog:
347
+ #sys.stderr.write("new_explog(%s)\n" % (explogfile))
348
+ explogwin.new_explog(hrefv(pathname2url(explogfile),contexthref=hrefv("./")),parentchecklisturl=parentchecklisturl,confighrefs=confighrefs)
349
+ pass
350
+ elif explogfile is not None and not newlog:
351
+ #sys.stderr.write("open_explog(%s)\n" % (explogfile))
352
+ explogwin.open_explog(hrefv(pathname2url(explogfile),contexthref=hrefv("./")),confighrefs=confighrefs)
353
+ pass
354
+
355
+
356
+ ## load config files
357
+ #for configfile in configfiles:
358
+ # #sys.stderr.write("datacollect2: Loading config file %s\n" % (configfile))
359
+ # confighref=hrefv(pathname2url(configfile))
360
+ # explogwin.load_config(confighref)
361
+ # pass
362
+
363
+
364
+ # update paramdb entries specified in .dpd file
365
+ dpdlog=[]
366
+ for paramupdate in paramupdates:
367
+ dpdlog.extend(paramdbfile.apply_paramdb_updates(paramupdate,paramdb))
368
+ pass
369
+
370
+ for (paramname,status,val1,val2) in dpdlog:
371
+ if status=="dangerous":
372
+ sys.stderr.write("Warning loading %s: Dangerous parameter %s ignored\n" % (dpdfile,paramname))
373
+ pass
374
+ elif status=="mismatch":
375
+ sys.stderr.write("Warning loading %s: Parameter %s request mismatch (requested: %s; actual: %s)\n" % (dpdfile,paramname,str(val1),str(val2)))
376
+ pass
377
+ elif status=="error":
378
+ sys.stderr.write("Warning loading %s: Parameter %s request error (requested: %s)\n" % (dpdfile,paramname,str(val1)))
379
+ pass
380
+ elif status!="match":
381
+ raise ValueError("Unknown status message loading paramdb from %s" % (dpdfile))
382
+
383
+ pass
384
+
385
+
386
+
387
+
388
+
389
+ if explogwin.explog is not None and explogwin.explog.filehref is not None:
390
+ for gui in guis:
391
+ guihref=hrefv(pathname2url(gui),contexthref=hrefv("./"))
392
+ explogwin.open_gui(guihref)
393
+ #explogwin.open_gui(gui)
394
+ pass
395
+
396
+ for checklist in checklists:
397
+ checklisthref=hrefv(pathname2url(checklist),contexthref=hrefv("./"))
398
+
399
+ explogwin.addtochecklistmenu(checklisthref)
400
+ explogwin.open_checklist(checklisthref)
401
+ pass
402
+
403
+ for plan in plans:
404
+ planhref=hrefv(pathname2url(plan),contexthref=hrefv("./"))
405
+ explogwin.open_plan(planhref)
406
+ pass
407
+ pass
408
+ elif len(guis) > 0 or len(checklists) > 0 or len(plans) > 0:
409
+ print("Cannot auto-open gui, checklist, or plan unless experiment log opened.")
410
+ sys.exit(1)
411
+ pass
412
+
413
+
414
+
415
+ #win=explogwin.getwindow()
416
+ explogwin.show_all()
417
+ gtk.main()
418
+ pass