tomwer 1.2.0a3__py3-none-any.whl → 1.2.0a4__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.
@@ -1,169 +1,169 @@
1
- import logging
2
-
3
- from orangewidget import gui
4
- from orangewidget.settings import Setting
5
- from orangewidget.widget import Input, Output
6
- from orangecontrib.tomwer.orange.managedprocess import TomwerWithStackStack
7
- from silx.gui import qt
8
- from typing import Optional
9
-
10
- from tomwer.core.futureobject import FutureTomwerObject
11
- from tomwer.core.scan.scanbase import TomwerScanBase
12
- from tomwer.gui.reconstruction.nabu.helical import HelicalPrepareWeightsDouble
13
- from tomwer.core.process.reconstruction.nabu.helical import (
14
- NabuHelicalPrepareWeightsDouble,
15
- )
16
- from tomwer.core.scan.hdf5scan import HDF5TomoScan
17
-
18
- _logger = logging.getLogger(__name__)
19
-
20
-
21
- class NabuHelicalPrepareWeightsDoubleOW(
22
- TomwerWithStackStack,
23
- ewokstaskclass=NabuHelicalPrepareWeightsDouble,
24
- ):
25
- """
26
- widget used to call the `nabu-helical-prepare-weights-double` application on a dedicated thread. It define weights map and double flat field.
27
-
28
- :param parent: the parent widget
29
- """
30
-
31
- # note of this widget should be the one registered on the documentation
32
- name = "helical prepate weights double"
33
- id = "orangecontrib.tomwer.widgets.reconstruction.NabuHelicalPrepareWeightsDoubleOW.NabuHelicalPrepareWeightsDoubleOW"
34
- description = "compute map of weights requested for nabu helical reconstruction"
35
- icon = "icons/nabu_prepare_weights_double.svg"
36
- priority = 199
37
- keywords = [
38
- "tomography",
39
- "nabu",
40
- "reconstruction",
41
- "nabu-helical",
42
- "helical",
43
- "weights",
44
- "prepare",
45
- ]
46
-
47
- want_main_area = True
48
- want_control_area = False
49
- resizing_enabled = True
50
-
51
- _ewoks_default_inputs = Setting(
52
- {
53
- "data": None,
54
- "transition_width": 50,
55
- "processes_file": "",
56
- }
57
- )
58
-
59
- sigScanReady = qt.Signal(TomwerScanBase)
60
- "Signal emitted when a scan is ended"
61
-
62
- TIMEOUT = 30
63
-
64
- class Inputs:
65
- data = Input(
66
- name="data",
67
- type=TomwerScanBase,
68
- doc="one scan to be process",
69
- default=True,
70
- multiple=False,
71
- )
72
-
73
- class Outputs:
74
- data = Output(name="data", type=TomwerScanBase, doc="one scan to be process")
75
- future_tomo_obj = Output(
76
- name="future_tomo_obj",
77
- type=FutureTomwerObject,
78
- doc="future object (process remotely)",
79
- )
80
-
81
- LOGGER = _logger
82
-
83
- def __init__(self, parent=None):
84
- super().__init__(parent)
85
- self.__scan = None
86
-
87
- # gui definition
88
- _layout = gui.vBox(self.mainArea, self.name).layout()
89
- self.widget = HelicalPrepareWeightsDouble(parent=self)
90
- _layout.addWidget(self.widget)
91
-
92
- ## connect signal / slot
93
- self.widget.sigConfigChanged.connect(self._updateSettings)
94
-
95
- self.task_output_changed_callbacks.add(self._notify_state)
96
-
97
- ## handle settings
98
- self._loadSettings()
99
- self.task_executor_queue.sigComputationStarted.connect(self._newTaskStarted)
100
-
101
- def _updateSettings(self):
102
- config = self.widget.getConfiguration()
103
- for key in ("transition_width", "processes_file"):
104
- self._ewoks_default_inputs[key] = config[key] # pylint: disable=E1137
105
-
106
- @property
107
- def request_input(self):
108
- return self.__request_input
109
-
110
- @request_input.setter
111
- def request_input(self, request):
112
- self.__request_input = request
113
-
114
- def get_task_inputs(self):
115
- assert self.__scan is not None
116
- return {
117
- "data": self.__scan,
118
- "transition_width": self.widget.getConfiguration()["transition_width"],
119
- "processes_file": self.widget.getConfiguration()["processes_file"],
120
- }
121
-
122
- def handleNewSignals(self) -> None:
123
- """Invoked by the workflow signal propagation manager after all
124
- signals handlers have been called.
125
- """
126
- # for now we want to avoid propagation any processing.
127
- # task will be executed only when the user validates the dialog
128
- data = super().get_task_inputs().get("data", None)
129
- if data is not None:
130
- if not isinstance(data, HDF5TomoScan):
131
- raise TypeError(
132
- f"data is expected to be an instance of HDF5TomoScan. {type(data)} are not handled"
133
- )
134
- self.add(data.path)
135
-
136
- def _loadSettings(self):
137
- self.widget.setConfiguration(self._ewoks_default_inputs)
138
-
139
- def _newTaskStarted(self):
140
- try:
141
- task_executor = self.sender()
142
- scan = task_executor.current_task.inputs.data
143
- self.notify_on_going(scan)
144
- except Exception:
145
- pass
146
-
147
- def _notify_state(self):
148
- try:
149
- task_executor = self.sender()
150
- task_suceeded = task_executor.succeeded
151
- scan = task_executor.current_task.outputs.data
152
- if task_suceeded:
153
- self.notify_succeed(scan=scan)
154
- else:
155
- self.notify_failed(scan=scan)
156
- except Exception as e:
157
- _logger.error(f"failed to handle task finished callback. Raiseon is {e}")
158
-
159
- @Inputs.data
160
- def process_data(self, scan: Optional[TomwerScanBase]):
161
- if scan is None:
162
- return
163
- else:
164
- self.__scan = scan
165
- self.notify_pending(scan=scan)
166
- self.execute_ewoks_task()
167
-
168
- def sizeHint(self) -> qt.QSize:
169
- return qt.QSize(650, 60)
1
+ # import logging
2
+
3
+ # from orangewidget import gui
4
+ # from orangewidget.settings import Setting
5
+ # from orangewidget.widget import Input, Output
6
+ # from orangecontrib.tomwer.orange.managedprocess import TomwerWithStackStack
7
+ # from silx.gui import qt
8
+ # from typing import Optional
9
+
10
+ # from tomwer.core.futureobject import FutureTomwerObject
11
+ # from tomwer.core.scan.scanbase import TomwerScanBase
12
+ # from tomwer.gui.reconstruction.nabu.helical import HelicalPrepareWeightsDouble
13
+ # from tomwer.core.process.reconstruction.nabu.helical import (
14
+ # NabuHelicalPrepareWeightsDouble,
15
+ # )
16
+ # from tomwer.core.scan.hdf5scan import HDF5TomoScan
17
+
18
+ # _logger = logging.getLogger(__name__)
19
+
20
+
21
+ # class NabuHelicalPrepareWeightsDoubleOW(
22
+ # TomwerWithStackStack,
23
+ # ewokstaskclass=NabuHelicalPrepareWeightsDouble,
24
+ # ):
25
+ # """
26
+ # widget used to call the `nabu-helical-prepare-weights-double` application on a dedicated thread. It define weights map and double flat field.
27
+
28
+ # :param parent: the parent widget
29
+ # """
30
+
31
+ # # note of this widget should be the one registered on the documentation
32
+ # name = "helical prerate weights double"
33
+ # id = "orangecontrib.tomwer.widgets.reconstruction.NabuHelicalPrepareWeightsDoubleOW.NabuHelicalPrepareWeightsDoubleOW"
34
+ # description = "compute map of weights requested for nabu helical reconstruction"
35
+ # icon = "icons/nabu_prepare_weights_double.svg"
36
+ # priority = 199
37
+ # keywords = [
38
+ # "tomography",
39
+ # "nabu",
40
+ # "reconstruction",
41
+ # "nabu-helical",
42
+ # "helical",
43
+ # "weights",
44
+ # "prepare",
45
+ # ]
46
+
47
+ # want_main_area = True
48
+ # want_control_area = False
49
+ # resizing_enabled = True
50
+
51
+ # _ewoks_default_inputs = Setting(
52
+ # {
53
+ # "data": None,
54
+ # "transition_width": 50,
55
+ # "processes_file": "",
56
+ # }
57
+ # )
58
+
59
+ # sigScanReady = qt.Signal(TomwerScanBase)
60
+ # "Signal emitted when a scan is ended"
61
+
62
+ # TIMEOUT = 30
63
+
64
+ # class Inputs:
65
+ # data = Input(
66
+ # name="data",
67
+ # type=TomwerScanBase,
68
+ # doc="one scan to be process",
69
+ # default=True,
70
+ # multiple=False,
71
+ # )
72
+
73
+ # class Outputs:
74
+ # data = Output(name="data", type=TomwerScanBase, doc="one scan to be process")
75
+ # future_tomo_obj = Output(
76
+ # name="future_tomo_obj",
77
+ # type=FutureTomwerObject,
78
+ # doc="future object (process remotely)",
79
+ # )
80
+
81
+ # LOGGER = _logger
82
+
83
+ # def __init__(self, parent=None):
84
+ # super().__init__(parent)
85
+ # self.__scan = None
86
+
87
+ # # gui definition
88
+ # _layout = gui.vBox(self.mainArea, self.name).layout()
89
+ # self.widget = HelicalPrepareWeightsDouble(parent=self)
90
+ # _layout.addWidget(self.widget)
91
+
92
+ # ## connect signal / slot
93
+ # self.widget.sigConfigChanged.connect(self._updateSettings)
94
+
95
+ # self.task_output_changed_callbacks.add(self._notify_state)
96
+
97
+ # ## handle settings
98
+ # self._loadSettings()
99
+ # self.task_executor_queue.sigComputationStarted.connect(self._newTaskStarted)
100
+
101
+ # def _updateSettings(self):
102
+ # config = self.widget.getConfiguration()
103
+ # for key in ("transition_width", "processes_file"):
104
+ # self._ewoks_default_inputs[key] = config[key] # pylint: disable=E1137
105
+
106
+ # @property
107
+ # def request_input(self):
108
+ # return self.__request_input
109
+
110
+ # @request_input.setter
111
+ # def request_input(self, request):
112
+ # self.__request_input = request
113
+
114
+ # def get_task_inputs(self):
115
+ # assert self.__scan is not None
116
+ # return {
117
+ # "data": self.__scan,
118
+ # "transition_width": self.widget.getConfiguration()["transition_width"],
119
+ # "processes_file": self.widget.getConfiguration()["processes_file"],
120
+ # }
121
+
122
+ # def handleNewSignals(self) -> None:
123
+ # """Invoked by the workflow signal propagation manager after all
124
+ # signals handlers have been called.
125
+ # """
126
+ # # for now we want to avoid propagation any processing.
127
+ # # task will be executed only when the user validates the dialog
128
+ # data = super().get_task_inputs().get("data", None)
129
+ # if data is not None:
130
+ # if not isinstance(data, HDF5TomoScan):
131
+ # raise TypeError(
132
+ # f"data is expected to be an instance of HDF5TomoScan. {type(data)} are not handled"
133
+ # )
134
+ # self.add(data.path)
135
+
136
+ # def _loadSettings(self):
137
+ # self.widget.setConfiguration(self._ewoks_default_inputs)
138
+
139
+ # def _newTaskStarted(self):
140
+ # try:
141
+ # task_executor = self.sender()
142
+ # scan = task_executor.current_task.inputs.data
143
+ # self.notify_on_going(scan)
144
+ # except Exception:
145
+ # pass
146
+
147
+ # def _notify_state(self):
148
+ # try:
149
+ # task_executor = self.sender()
150
+ # task_suceeded = task_executor.succeeded
151
+ # scan = task_executor.current_task.outputs.data
152
+ # if task_suceeded:
153
+ # self.notify_succeed(scan=scan)
154
+ # else:
155
+ # self.notify_failed(scan=scan)
156
+ # except Exception as e:
157
+ # _logger.error(f"failed to handle task finished callback. Raiseon is {e}")
158
+
159
+ # @Inputs.data
160
+ # def process_data(self, scan: Optional[TomwerScanBase]):
161
+ # if scan is None:
162
+ # return
163
+ # else:
164
+ # self.__scan = scan
165
+ # self.notify_pending(scan=scan)
166
+ # self.execute_ewoks_task()
167
+
168
+ # def sizeHint(self) -> qt.QSize:
169
+ # return qt.QSize(650, 60)
@@ -85,6 +85,7 @@ def main(argv):
85
85
  options.scan_path = options.scan_path.rstrip(os.path.sep)
86
86
 
87
87
  widget = ImageKeyDialog(parent=None)
88
+ widget.setWindowFlags(qt.Qt.Window)
88
89
  widget.setScan(scan)
89
90
  widget.setWindowTitle("Image key editor")
90
91
  widget.setWindowIcon(icons.getQIcon("tomwer"))
@@ -94,6 +94,8 @@ def main(argv):
94
94
  options.scan_path = options.scan_path.rstrip(os.path.sep)
95
95
 
96
96
  widget = ImageKeyUpgraderDialog(parent=None)
97
+ widget.setWindowFlags(qt.Qt.Window)
98
+
97
99
  widget.setScan(scan)
98
100
  widget.setWindowTitle("Image key upgrader")
99
101
  widget.setWindowIcon(icons.getQIcon("tomwer"))
@@ -83,6 +83,8 @@ def main(argv):
83
83
  return
84
84
 
85
85
  dialog = NXtomoEditorDialog()
86
+ dialog.setWindowFlags(qt.Qt.Window)
87
+
86
88
  dialog.setScan(scan)
87
89
  dialog.show()
88
90
  splash.finish(dialog)
tomwer/app/zstitching.py CHANGED
@@ -257,6 +257,7 @@ def main(argv):
257
257
  timer.timeout.connect(lambda: None)
258
258
 
259
259
  window = MainWindow()
260
+ window.setWindowFlags(qt.Qt.Window)
260
261
 
261
262
  window.show()
262
263
  from sluurp.utils import has_sbatch_available