Skip to content

Commit

Permalink
Minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexShkarin committed Nov 25, 2021
1 parent b9be528 commit 9eae3b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pylablib/core/gui/value_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,16 @@ class StandardValueHandler(IValueHandler):
"""
def __init__(self, widget, default_name=None):
super().__init__(widget)
self.get_value_kind=get_method_kind(getattr(self.widget,"get_value",None))
self.get_value_kind=get_method_kind(getattr(self.widget,"get_value")) if _hasattr(self.widget,"get_value") else None
self.get_all_values_kind="simple" if _hasattr(self.widget,"get_all_values") else None
if not (self.get_value_kind or self.get_all_values_kind):
raise ValueError("can't find default getter for widget {}".format(self.widget))
self.set_value_kind=get_method_kind(getattr(self.widget,"set_value",None),add_args=1)
self.set_value_kind=get_method_kind(getattr(self.widget,"set_value"),add_args=1) if _hasattr(self.widget,"set_value") else None
self.set_all_values_kind="simple" if _hasattr(self.widget,"set_all_values") else None
if not (self.set_value_kind or self.set_all_values_kind):
raise ValueError("can't find default setter for widget {}".format(self.widget))
self.repr_value_kind=get_method_kind(getattr(self.widget,"repr_value",None),add_args=1)
self.get_handler_kind=get_method_kind(getattr(self.widget,"get_handler",None))
self.repr_value_kind=get_method_kind(getattr(self.widget,"repr_value"),add_args=1) if _hasattr(self.widget,"repr_value") else None
self.get_handler_kind=get_method_kind(getattr(self.widget,"get_handler")) if _hasattr(self.widget,"get_handler") else None
self.default_name=default_name
def get_value(self, name=None):
if name is None:
Expand Down Expand Up @@ -511,9 +511,9 @@ class StandardIndicatorHandler(IIndicatorHandler):
def __init__(self, widget, default_name=None):
IIndicatorHandler.__init__(self)
self.widget=widget
self.get_indicator_kind=get_method_kind(getattr(self.widget,"get_indicator",None))
self.get_indicator_kind=get_method_kind(getattr(self.widget,"get_indicator")) if _hasattr(self.widget,"get_indicator") else None
self.get_all_indicators_kind="simple" if _hasattr(self.widget,"get_all_indicators") else None
self.set_indicator_kind=get_method_kind(getattr(self.widget,"set_indicator",None),add_args=1)
self.set_indicator_kind=get_method_kind(getattr(self.widget,"set_indicator"),add_args=1) if _hasattr(self.widget,"set_indicator") else None
self.set_all_indicators_kind="simple" if _hasattr(self.widget,"set_all_indicators") else None
self.default_name=default_name
def get_value(self, name=None):
Expand Down
9 changes: 8 additions & 1 deletion pylablib/gui/widgets/plotters/line_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import pyqtgraph
from ....core.utils import dictionary


class LinePlotter(pyqtgraph.PlotWidget):
Expand Down Expand Up @@ -88,4 +89,10 @@ def update_traces(self, only_new_data=True):
if len(t):
self._traces[n][0].setData(t[:,0],t[:,1])
else:
self._traces[n][0].setData([],[])
self._traces[n][0].setData([],[])

def get_all_values(self):
"""Dummy method to satisfy child widget requirements"""
return dictionary.Dictionary()
def set_all_values(self, values):
"""Dummy method to satisfy child widget requirements"""
2 changes: 1 addition & 1 deletion pylablib/thread/device_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def add_device_command(self, name, command_name=None, post_update="update_parame
`post_update` is a string or a list of strings which specifies which update methods to call after the command.
Check if the devices is opened, do nothing if it is not.
"""
if not isinstance(post_update,list):
if not isinstance(post_update,(list,tuple)):
post_update=[] if post_update is None else [post_update]
command_name=command_name or name
def command(*args, **kwargs):
Expand Down

0 comments on commit 9eae3b5

Please sign in to comment.