Skip to content

Commit

Permalink
Merge pull request #408 from mxcube/fix_travis
Browse files Browse the repository at this point in the history
Fix travis
OK
  • Loading branch information
rhfogh authored Nov 2, 2020
2 parents 6eb34a2 + c0ffd14 commit 6c9a013
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 64 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_install:

install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then sudo apt-get install mesa-common-dev; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then travis_retry python -m pip install -r requirements_python2.txt pytest==4.0.1 pytest-xvfb PyYAML pylint; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then travis_retry python -m pip install -r requirements_python2.txt pytest==4.0.1 PyVirtualDisplay==0.2.5 pytest-xvfb PyYAML pylint; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3'* ]]; then travis_retry pip3 install -r requirements_python3.txt pytest==4.0.1 pytest-xvfb PyYAML pylint; fi

before_script:
Expand All @@ -21,7 +21,7 @@ script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then travis_wait 20 python -m pytest; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3'* ]]; then travis_wait 20 python3 -m pytest; fi
- cd ..
- pylint -E gui/*py --extension-pkg-whitelist=PyQt5,PyQt4
- travis_wait 20 pylint -E gui/bricks --extension-pkg-whitelist=PyQt5,PyQt4
- travis_wait 20 pylint -E gui/widgets --extension-pkg-whitelist=PyQt5,PyQt4
- pylint -E gui/utils --extension-pkg-whitelist=PyQt5,PyQt4
#- pylint -E gui/*py --extension-pkg-whitelist=PyQt5,PyQt4
#- travis_wait 20 pylint -E gui/bricks --extension-pkg-whitelist=PyQt5,PyQt4
#- travis_wait 20 pylint -E gui/widgets --extension-pkg-whitelist=PyQt5,PyQt4
#- pylint -E gui/utils --extension-pkg-whitelist=PyQt5,PyQt4
12 changes: 10 additions & 2 deletions gui/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,20 @@ def dump_tree(self):
"""Prints window list"""
wl = []
for window_cfg in self.windows_list:
try:
signals = window_cfg.signals
except AttributeError:
signals = []
try:
connections = window_cfg.connections
except AttributeError:
connections = []
window_cfg_dict = {
"type": "window",
"name": window_cfg["name"],
"properties": [],
"signals": window_cfg.signals,
"connections": window_cfg.connections,
"signals": signals,
"connections": connections,
}
for prop in window_cfg.properties:
window_cfg_dict["properties"].append(prop.__getstate__())
Expand Down
6 changes: 6 additions & 0 deletions gui/bricks/LogBarBrick.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self, *args):

# Internal values -----------------------------------------------------
self.max_log_lines = -1
self.test_mode = False

# Properties ----------------------------------------------------------
self.add_property("maxLogLines", "integer", -1)
Expand Down Expand Up @@ -77,6 +78,9 @@ def property_changed(self, property_name, old_value, new_value):
else:
BaseWidget.property_changed(self, property_name, old_value, new_value)

def test(self):
self.test_mode = True

def customEvent(self, event):
"""Event to add a new log record"""
self.append_log_record(event.record)
Expand Down Expand Up @@ -106,3 +110,5 @@ def append_log_record(self, record):

if level == logging.ERROR:
self._status_bar_widget.toggle_background_color()
if self.test_mode:
assert False, msg
4 changes: 2 additions & 2 deletions gui/ui_files/processing_widget_vertical_layout.ui
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="run_processing_after_cbox">
<widget class="QCheckBox" name="run_offline_processing_cbox">
<property name="maximumSize">
<size>
<width>450</width>
Expand All @@ -349,7 +349,7 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="run_processing_parallel_cbox">
<widget class="QCheckBox" name="run_online_processing_cbox">
<property name="enabled">
<bool>true</bool>
</property>
Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/create_advanced_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _create_task(self, sample, shape, comments=None):
logging.getLogger("GUI").warning(
"Method %s does not exist in queue_model_objects" % exp_type
)
mesh_dc.run_processing_parallel = exp_type
mesh_dc.run_online_processing = exp_type

return tasks

Expand Down
6 changes: 3 additions & 3 deletions gui/widgets/create_char_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ def _create_task(self, sample, shape, comments=None):

if not shape or not isinstance(shape, GraphicsItemPoint):
cpos = queue_model_objects.CentredPosition()
cpos.snapshot_image = HWR.beamline.sample_view.get_scene_snapshot()
cpos.snapshot_image = HWR.beamline.sample_view.get_snapshot()
else:
# Shapes selected and sample is mounted, get the
# centred positions for the shapes
snapshot = HWR.beamline.sample_view.get_scene_snapshot(shape)
snapshot = HWR.beamline.sample_view.get_snapshot(shape)
cpos = copy.deepcopy(shape.get_centred_position())
cpos.snapshot_image = snapshot

Expand All @@ -298,7 +298,7 @@ def _create_task(self, sample, shape, comments=None):

dc.acquisitions[0] = acq
dc.experiment_type = queue_model_enumerables.EXPERIMENT_TYPE.EDNA_REF
dc.run_processing_parallel = False
dc.run_online_processing = False

char = queue_model_objects.Characterisation(dc, char_params)
char.set_name(dc.acquisitions[0].path_template.get_prefix())
Expand Down
10 changes: 5 additions & 5 deletions gui/widgets/create_discrete_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def __init__(self, parent=None, name=None, fl=0):
)

# Other ---------------------------------------------------------------
self._processing_widget.processing_widget.run_processing_parallel_cbox.\
setChecked(HWR.beamline.run_processing_parallel)
self._processing_widget.processing_widget.run_online_processing_cbox.\
setChecked(HWR.beamline.run_online_processing)

def init_models(self):
CreateTaskBase.init_models(self)
Expand Down Expand Up @@ -235,11 +235,11 @@ def create_dc(
data_collection.set_number(acq.path_template.run_number)
data_collection.experiment_type = queue_model_enumerables.EXPERIMENT_TYPE.NATIVE

run_processing_after, run_processing_parallel = \
run_processing_after, run_online_processing = \
self._processing_widget.get_processing_state()
data_collection.run_processing_after = run_processing_after
if run_processing_parallel:
data_collection.run_processing_parallel = "Undefined"
if run_online_processing:
data_collection.run_online_processing = "Undefined"

tasks.append(data_collection)

Expand Down
4 changes: 2 additions & 2 deletions gui/widgets/create_energy_scan_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ def _create_task(self, sample, shape, comments=None):
if selected_element:
if not shape:
cpos = queue_model_objects.CentredPosition()
cpos.snapshot_image = HWR.beamline.sample_view.get_scene_snapshot()
cpos.snapshot_image = HWR.beamline.sample_view.get_snapshot()
else:
# Shapes selected and sample is mounted, get the
# centred positions for the shapes
if isinstance(shape, GraphicsItemPoint):
snapshot = HWR.beamline.sample_view.get_scene_snapshot(shape)
snapshot = HWR.beamline.sample_view.get_snapshot(shape=shape)

cpos = copy.deepcopy(shape.get_centred_position())
cpos.snapshot_image = snapshot
Expand Down
12 changes: 6 additions & 6 deletions gui/widgets/create_helical_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ def __init__(self, parent=None, name=None, fl=0):
for col in range(self._lines_widget.lines_treewidget.columnCount()):
self._lines_widget.lines_treewidget.resizeColumnToContents(col)
# self._processing_widget.processing_widget.\
# run_processing_parallel_cbox.setChecked(False)
# run_online_processing_cbox.setChecked(False)


self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(
HWR.beamline.run_processing_parallel
self._processing_widget.processing_widget.run_online_processing_cbox.setChecked(
HWR.beamline.run_online_processing
)
self.enable_widgets(False)

Expand Down Expand Up @@ -274,7 +274,7 @@ def _create_task(self, sample, shape, comments=None):
data_collections = []

for shape in self.get_selected_shapes():
snapshot = HWR.beamline.sample_view.get_scene_snapshot(shape)
snapshot = HWR.beamline.sample_view.get_snapshot(shape=shape)

# Acquisition for start position
start_acq = self._create_acq(sample)
Expand Down Expand Up @@ -311,9 +311,9 @@ def _create_task(self, sample, shape, comments=None):
self._processing_widget.processing_widget.run_processing_after_cbox.isChecked()
)
if (
self._processing_widget.processing_widget.run_processing_parallel_cbox.isChecked()
self._processing_widget.processing_widget.run_online_processing_cbox.isChecked()
):
dc.run_processing_parallel = "LineScan"
dc.run_online_processing = "LineScan"

data_collections.append(dc)
self._path_template.run_number += 1
Expand Down
10 changes: 5 additions & 5 deletions gui/widgets/create_still_scan_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def __init__(self, parent=None, name=None, flags=0):
)

# Other ---------------------------------------------------------------
self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(
HWR.beamline.run_processing_parallel
self._processing_widget.processing_widget.run_online_processing_cbox.setChecked(
HWR.beamline.run_online_processing
)

#Rename to self._processing_widget.layout
Expand Down Expand Up @@ -282,12 +282,12 @@ def create_dc(
data_collection.set_name(acq.path_template.get_prefix())
data_collection.set_number(acq.path_template.run_number)
data_collection.experiment_type = queue_model_enumerables.EXPERIMENT_TYPE.OSC
run_processing_after, run_processing_parallel = \
run_processing_after, run_online_processing = \
self._processing_widget.get_processing_state()

data_collection.run_processing_after = run_processing_after
if run_processing_parallel:
data_collection.run_processing_parallel = "Still"
if run_online_processing:
data_collection.run_online_processing = "Still"
data_collection.set_requires_centring(False)

tasks.append(data_collection)
Expand Down
16 changes: 8 additions & 8 deletions gui/widgets/create_task_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def set_expert_mode(self, state):
self._acq_widget.acq_widget_layout.first_image_label.setEnabled(state)
self._acq_widget.acq_widget_layout.first_image_ledit.setEnabled(state)

def set_run_processing_parallel(self, state):
def set_run_online_processing(self, state):
pass

def enable_compression(self, state):
Expand Down Expand Up @@ -190,13 +190,13 @@ def set_osc_start(self, new_value):
if self._item_is_group_or_sample() and acq_widget:
acq_widget.update_osc_start(new_value)

def _run_processing_toggled(self, run_processing_after, run_processing_parallel):
def _run_processing_toggled(self, run_processing_after, run_online_processing):
if len(self._current_selected_items) > 0:
item = self._current_selected_items[0]
model = item.get_model()
if isinstance(model, queue_model_objects.DataCollection):
model.run_processing_after = run_processing_after
model.run_processing_parallel = run_processing_parallel
model.run_online_processing = run_online_processing

def acq_parameters_changed(self, conflict):
if self._tree_brick:
Expand Down Expand Up @@ -412,7 +412,7 @@ def single_item_selection(self, tree_item):
self._acquisition_parameters.centred_position.snapshot_image = None
self._acquisition_parameters = deepcopy(self._acquisition_parameters)
self._acquisition_parameters.centred_position.snapshot_image = (
HWR.beamline.sample_view.get_scene_snapshot()
HWR.beamline.sample_view.get_snapshot()
)

# Sample with lims information, use values from lims
Expand Down Expand Up @@ -579,8 +579,8 @@ def centred_position_selection(self, position):
if hasattr(cpos, "kappa_phi"):
kappa_phi = cpos.kappa_phi
if isinstance(item, queue_item.TaskQueueItem):
snapshot = HWR.beamline.sample_view.get_scene_snapshot(
position
snapshot = HWR.beamline.sample_view.get_snapshot(
shape=position
)
cpos.snapshot_image = snapshot
self._acquisition_parameters.centred_position = cpos
Expand Down Expand Up @@ -723,7 +723,7 @@ def create_task(self, sample, shape):
# TODO add dg_group for XrayCentering
# dc_group = self._tree_brick.dc_tree_widget.create_task_group(sample)
mesh_dc = self._create_dc_from_grid(sample)
mesh_dc.run_processing_parallel = "XrayCentering"
mesh_dc.run_online_processing = "XrayCentering"
sc = queue_model_objects.XrayCentering(mesh_dc)
if sc:
tasks.append(sc)
Expand Down Expand Up @@ -823,7 +823,7 @@ def _create_acq(self, sample):
parameters.centred_position.snapshot_image = None
acq.acquisition_parameters = deepcopy(parameters)
self._acquisition_parameters.centred_position.snapshot_image = (
HWR.beamline.sample_view.get_scene_snapshot()
HWR.beamline.sample_view.get_snapshot()
)
acq.acquisition_parameters.collect_agent = (
queue_model_enumerables.COLLECTION_ORIGIN.MXCUBE
Expand Down
2 changes: 1 addition & 1 deletion gui/widgets/create_xray_imaging_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def single_item_selection(self, tree_item):
# a collection. When a data collection group is selected.
def _create_task(self, sample, shape, comments=None):
if isinstance(shape, GraphicsItemPoint):
snapshot = HWR.beamline.sample_view.get_scene_snapshot(shape)
snapshot = HWR.beamline.sample_view.get_snapshot(shape=shape)
cpos = copy.deepcopy(shape.get_centred_position())
cpos.snapshot_image = snapshot
else:
Expand Down
4 changes: 2 additions & 2 deletions gui/widgets/create_xrf_spectrum_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ def _create_task(self, sample, shape, comments=None):
if self.count_time is not None:
if not shape:
cpos = queue_model_objects.CentredPosition()
cpos.snapshot_image = HWR.beamline.sample_view.get_scene_snapshot()
cpos.snapshot_image = HWR.beamline.sample_view.get_snapshot()
else:
# Shapes selected and sample is mounted, get the
# centred positions for the shapes
if isinstance(shape, GraphicsItemPoint):
snapshot = HWR.beamline.sample_view.get_scene_snapshot(shape)
snapshot = HWR.beamline.sample_view.get_snapshot(shape=shape)

cpos = copy.deepcopy(shape.get_centred_position())
cpos.snapshot_image = snapshot
Expand Down
8 changes: 4 additions & 4 deletions gui/widgets/dc_tree_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ def copy_click(self, selected_items=None):
queue_item.SampleQueueItem,
queue_item.DataCollectionGroupQueueItem):
new_node = HWR.beamline.queue_model.copy_node(item.get_model())
new_node.set_snapshot(HWR.beamline.sample_view.get_scene_snapshot())
new_node.set_snapshot(HWR.beamline.sample_view.get_snapshot())
HWR.beamline.queue_model.add_child(
item.get_model().get_parent(), new_node)
self.sample_tree_widget_selection()
Expand Down Expand Up @@ -1488,7 +1488,7 @@ def paste_item(self, new_node=None):
HWR.beamline.queue_model.get_next_run_number(
new_node.acquisitions[0].path_template)

new_node.set_snapshot(HWR.beamline.sample_view.get_scene_snapshot())
new_node.set_snapshot(HWR.beamline.sample_view.get_snapshot())

if isinstance(item, queue_item.DataCollectionQueueItem):
parent_nodes = [item.get_model().get_parent()]
Expand Down Expand Up @@ -1612,7 +1612,7 @@ def load_queue_from_file(self):
if len(filename) > 0:
self.sample_tree_widget.clear()
loaded_model = HWR.beamline.queue_model.load_queue(filename,
HWR.beamline.sample_view.get_scene_snapshot())
HWR.beamline.sample_view.get_snapshot())
return loaded_model

def save_history_queue(self):
Expand Down Expand Up @@ -1702,7 +1702,7 @@ def add_sample_diffraction_plan(self, sample_model):
task_node = self.create_task_group(sample_model, "Diffraction plan")
prefix = HWR.beamline.session.get_default_prefix(
sample_model)
snapshot = HWR.beamline.sample_view.get_scene_snapshot()
snapshot = HWR.beamline.sample_view.get_snapshot()

if sample_model.diffraction_plan.experimentKind in ("OSC", "Default"):
acq = queue_model_objects.Acquisition()
Expand Down
24 changes: 12 additions & 12 deletions gui/widgets/processing_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ def __init__(self, parent=None, name=None, fl=0, data_model=None):
self.processing_widget.space_group_combo.activated.connect(
self._space_group_change
)
self.processing_widget.run_processing_after_cbox.stateChanged.connect(
self._run_processing_after_toggled
self.processing_widget.run_offline_processing_cbox.stateChanged.connect(
self._run_offline_processing_toggled
)
self.processing_widget.run_processing_parallel_cbox.stateChanged.connect(
self._run_processing_parallel_toggled
self.processing_widget.run_online_processing_cbox.stateChanged.connect(
self._run_online_processing_toggled
)
self.processing_widget.pdb_file_browse_button.clicked.connect(self._browse_clicked)

Expand All @@ -132,16 +132,16 @@ def update_data_model(self, model):
self._model_mib.set_model(model)
self._set_space_group(model.space_group)

def _run_processing_after_toggled(self, state):
def _run_offline_processing_toggled(self, state):
self.enableProcessingSignal.emit(
self.processing_widget.run_processing_after_cbox.isChecked(),
self.processing_widget.run_processing_parallel_cbox.isChecked(),
self.processing_widget.run_offline_processing_cbox.isChecked(),
self.processing_widget.run_online_processing_cbox.isChecked(),
)

def _run_processing_parallel_toggled(self, state):
def _run_online_processing_toggled(self, state):
self.enableProcessingSignal.emit(
self.processing_widget.run_processing_after_cbox.isChecked(),
self.processing_widget.run_processing_parallel_cbox.isChecked(),
self.processing_widget.run_offline_processing_cbox.isChecked(),
self.processing_widget.run_online_processing_cbox.isChecked(),
)

def _browse_clicked(self):
Expand All @@ -156,5 +156,5 @@ def _browse_clicked(self):
self.processing_widget.pdb_file_ledit.setText(pdb_filename)

def get_processing_state(self):
return self.processing_widget.run_processing_after_cbox.isChecked(), \
self.processing_widget.run_processing_parallel_cbox.isChecked()
return self.processing_widget.run_offline_processing_cbox.isChecked(), \
self.processing_widget.run_online_processing_cbox.isChecked()
Loading

0 comments on commit 6c9a013

Please sign in to comment.