Skip to content

Commit

Permalink
ref: cleanup (default arguments and PyQt5 object references)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 8, 2021
1 parent 5c58d0b commit ebc3269
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
2.6.7
- fix: correctly handle missing features on data export (#80)
- ref: cleanup (default arguments and PyQt5 object references)
- setup: bump dclab from 0.34.2 to 0.34.3 (set R_HOME)
- build: bumpy rpy2 from 3.4.2 to 3.4.5
- build: bumpy pyqtgraph from 0.12.1 to 0.12.2 and remove
Expand Down
6 changes: 3 additions & 3 deletions shapeout2/gui/compute/comp_lme4.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ def __init__(self, parent, pipeline, *args, **kwargs):
self.update()

# button signals
btn_close = self.buttonBox.button(QtGui.QDialogButtonBox.Close)
btn_close = self.buttonBox.button(QtWidgets.QDialogButtonBox.Close)
btn_close.clicked.connect(self.on_close)
btn_close.setToolTip("Close this dialog")
closeicon = QtGui.QIcon.fromTheme("dialog-close")
btn_close.setIcon(closeicon)
btn_openlme4 = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)
btn_openlme4 = self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply)
btn_openlme4.clicked.connect(self.on_lme4)
btn_openlme4.setToolTip("Perform lme4 analysis")
btn_openlme4.setText("Run R-lme4")
picon = QtGui.QIcon.fromTheme("rlang")
btn_openlme4.setIcon(picon)
btn_help = self.buttonBox.button(QtGui.QDialogButtonBox.Help)
btn_help = self.buttonBox.button(QtWidgets.QDialogButtonBox.Help)
btn_help.clicked.connect(self.on_help)
btn_help.setToolTip("View R-lme4 Quick Guide online")
helpicon = QtGui.QIcon.fromTheme("documentinfo")
Expand Down
4 changes: 2 additions & 2 deletions shapeout2/gui/compute/comp_lme4_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def __init__(self, parent, rlme4_results, *args, **kwargs):
self.plainTextEdit.setPlainText("\n".join(summary))

# button signals
btn_close = self.buttonBox.button(QtGui.QDialogButtonBox.Close)
btn_close = self.buttonBox.button(QtWidgets.QDialogButtonBox.Close)
btn_close.clicked.connect(self.on_close)
btn_close.setToolTip("Close this dialog")
closeicon = QtGui.QIcon.fromTheme("dialog-close")
btn_close.setIcon(closeicon)
btn_openlme4 = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)
btn_openlme4 = self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply)
btn_openlme4.clicked.connect(self.on_save)
btn_openlme4.setToolTip("Save report as text file")
btn_openlme4.setText("Save report (.txt)")
Expand Down
6 changes: 3 additions & 3 deletions shapeout2/gui/dcor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ def __init__(self, parent, *args, **kwargs):
self.search_item_retrieved.connect(self.on_search_add_result)

# button signals
btn_close = self.buttonBox.button(QtGui.QDialogButtonBox.Close)
btn_close = self.buttonBox.button(QtWidgets.QDialogButtonBox.Close)
btn_close.clicked.connect(self.on_close)
btn_close.setToolTip("Close this window")
closeicon = QtGui.QIcon.fromTheme("dialog-close")
btn_close.setIcon(closeicon)
btn_open = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)
btn_open = self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply)
btn_open.clicked.connect(self.on_open)
btn_open.setToolTip("Add selected resources to current session")
btn_open.setText("Add to session")
plusicon = QtGui.QIcon.fromTheme("list-add")
btn_open.setIcon(plusicon)
btn_help = self.buttonBox.button(QtGui.QDialogButtonBox.Help)
btn_help = self.buttonBox.button(QtWidgets.QDialogButtonBox.Help)
btn_help.clicked.connect(self.on_help)
btn_help.setToolTip("View DCOR Quick Guide online")
helpicon = QtGui.QIcon.fromTheme("documentinfo")
Expand Down
4 changes: 3 additions & 1 deletion shapeout2/gui/quick_view/qv_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def __init__(self, *args, **kwargs):
# let view box update self.poly_line_roi
self._view_box.add_poly_vertex.connect(self.add_poly_vertex)

def activate_poly_mode(self, points=[]):
def activate_poly_mode(self, points=None):
if points is None:
points = []
if self.poly_line_roi is None:
self.poly_line_roi = pg.PolyLineROI([], closed=True)
self.poly_line_roi.setPen("k")
Expand Down
8 changes: 6 additions & 2 deletions shapeout2/plot_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@


def get_contour_data(rtdc_ds, xax, yax, xacc, yacc, xscale, yscale,
kde_type="histogram", kde_kwargs={}):
kde_type="histogram", kde_kwargs=None):
if kde_kwargs is None:
kde_kwargs = {}
rtdc_ds.apply_filter()
cfg = rtdc_ds.config
tohash = [
Expand Down Expand Up @@ -31,7 +33,9 @@ def get_contour_data(rtdc_ds, xax, yax, xacc, yacc, xscale, yscale,


def get_scatter_data(rtdc_ds, downsample, xax, yax, xscale, yscale,
kde_type="histogram", kde_kwargs={}):
kde_type="histogram", kde_kwargs=None):
if kde_kwargs is None:
kde_kwargs = {}
rtdc_ds.apply_filter()
cfg = rtdc_ds.config
tohash = [
Expand Down
10 changes: 6 additions & 4 deletions shapeout2/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@


class DataFileNotFoundError(BaseException):
def __init__(self, missing_paths, *args, **kwargs):
def __init__(self, missing_paths, *args):
self.missing_paths = missing_paths
super(DataFileNotFoundError, self).__init__(*args, **kwargs)
super(DataFileNotFoundError, self).__init__(*args)


class PathlibJSONEncoder(json.JSONEncoder):
Expand Down Expand Up @@ -84,7 +84,7 @@ def import_filters(path, pipeline, strict=False):
Parameters
----------
path: pathlib.Path or str
path: pathlib.Path or str or io.IOBase
Path to the filter file
pipeline: shapeout2.pipeline.Pipeline
Analysis pipeline to import filters to
Expand Down Expand Up @@ -292,7 +292,7 @@ def find_file(original_path, search_paths, partial_hash, size_read):
return path


def open_session(path, pipeline=None, search_paths=[]):
def open_session(path, pipeline=None, search_paths=None):
"""Load a session (optionally overriding an existing pipeline)
Parameters
Expand All @@ -305,6 +305,8 @@ def open_session(path, pipeline=None, search_paths=[]):
Paths to search for missing measurements; entries may be
directories or .rtdc files
"""
if search_paths is None:
search_paths = []
path = pathlib.Path(path)
if pipeline is None:
pipeline = Pipeline()
Expand Down

0 comments on commit ebc3269

Please sign in to comment.