Debian Codegraph @

pymeasure/display/widgets/tab_widget.py

raw
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2024 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24
25 import logging
26
27 log = logging.getLogger(__name__)
28 log.addHandler(logging.NullHandler())
29
30
31 class TabWidget:
32 """ Utility class to define default implementation for some basic methods.
33
34 When defining a widget to be used in subclasses of
35 :class:`ManagedWindowBase<pymeasure.display.windows.managed_window.ManagedWindowBase>`,
36 users should inherit from this class and provide an
37 implementation of these methods
38 """
39
40 def __init__(self, name, *args, **kwargs):
41 super().__init__(*args, **kwargs)
42 self.name = name
43
44 def new_curve(self, *args, **kwargs):
45 """ Create a new curve """
46 return None
47
48 def load(self, curve):
49 """ Add curve to widget """
50 pass
51
52 def remove(self, curve):
53 """ Remove curve from widget """
54 pass
55
56 def set_color(self, curve, color):
57 """ Set color for widget """
58 pass
59
60 def preview_widget(self, parent=None):
61 """ Return a Qt widget suitable for preview during loading
62
63 See also :class:`ResultsDialog<pymeasure.display.widgets.results_dialog.ResultsDialog>`
64 If the object returned is not None, then it should have also an
65 attribute `name`.
66 """
67
68 return None
69
70 def clear_widget(self):
71 """ Clear widget content
72
73 Behaviour is widget specific and it is currently used in preview mode
74 """
75
76 return None