happyscript 0.0.6__tar.gz → 0.0.7__tar.gz

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.
Files changed (47) hide show
  1. {happyscript-0.0.6 → happyscript-0.0.7}/PKG-INFO +1 -1
  2. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/__init__.py +1 -1
  3. happyscript-0.0.7/happyscript/charts/matplotlib_chart.py +71 -0
  4. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/panel_charts.py +8 -0
  5. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/form_main.py +1 -0
  6. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptgui.py +4 -0
  7. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptmanager.py +1 -1
  8. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript.egg-info/PKG-INFO +1 -1
  9. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript.egg-info/SOURCES.txt +1 -0
  10. {happyscript-0.0.6 → happyscript-0.0.7}/pyproject.toml +1 -1
  11. {happyscript-0.0.6 → happyscript-0.0.7}/README.md +0 -0
  12. {happyscript-0.0.6 → happyscript-0.0.7}/copy_code.py +0 -0
  13. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/__init__.py +0 -0
  14. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/chart.py +0 -0
  15. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/histogram_chart.py +0 -0
  16. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/histogram_series.py +0 -0
  17. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/scatter_chart.py +0 -0
  18. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/scatter_series.py +0 -0
  19. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/time_chart.py +0 -0
  20. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/charts/time_series.py +0 -0
  21. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/form_askchoice.py +0 -0
  22. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/form_askimage.py +0 -0
  23. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/form_ontestfailure.py +0 -0
  24. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/form_serials.py +0 -0
  25. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/form_stop.py +0 -0
  26. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/forms/formsbase.py +0 -0
  27. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/imglib.py +0 -0
  28. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/panels/panel_log.py +0 -0
  29. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/panels/panel_messages.py +0 -0
  30. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/panels/panel_scripts2.py +0 -0
  31. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/panels/panel_tests.py +0 -0
  32. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/panels/panelsbase.py +0 -0
  33. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptartwork.py +0 -0
  34. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptcontrol.py +0 -0
  35. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptexceptions.py +0 -0
  36. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptinfo.py +0 -0
  37. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptparams.py +0 -0
  38. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptreader.py +0 -0
  39. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/scriptrunner.py +0 -0
  40. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/testlog/global_log_handler.py +0 -0
  41. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/testlog/log_to_text.py +0 -0
  42. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/testlog/logtoxml.py +0 -0
  43. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript/testlog/printredirect.py +0 -0
  44. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript.egg-info/dependency_links.txt +0 -0
  45. {happyscript-0.0.6 → happyscript-0.0.7}/happyscript.egg-info/top_level.txt +0 -0
  46. {happyscript-0.0.6 → happyscript-0.0.7}/increment_version.py +0 -0
  47. {happyscript-0.0.6 → happyscript-0.0.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: happyscript
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Framework for running scripts
5
5
  Requires-Python: >=3.5
6
6
  Description-Content-Type: text/markdown
@@ -1,2 +1,2 @@
1
- __version__ = "0.0.6"
1
+ __version__ = "0.0.7"
2
2
  from .scriptmanager import ScriptManager
@@ -0,0 +1,71 @@
1
+ import logging
2
+ import wx
3
+ from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
4
+ from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar
5
+ from matplotlib.figure import Figure
6
+ import matplotlib.pyplot as plt
7
+ class MatPlotLibChart(wx.Panel):
8
+ def __init__(self, parent_control, name):
9
+ super().__init__(parent_control, -1)
10
+ self.__name = name
11
+ self.__dirty = False
12
+ self.__on_update_func = None
13
+ self.__figure = Figure(dpi=None, figsize=(2, 2))
14
+ self.__figure.set_tight_layout(True)
15
+ self.canvas = FigureCanvas(self, -1, self.__figure)
16
+ self.__toolbar = NavigationToolbar(self.canvas)
17
+ self.__toolbar.Realize()
18
+ sizer = wx.BoxSizer(wx.VERTICAL)
19
+ sizer.Add(self.canvas, 1, wx.EXPAND)
20
+ sizer.Add(self.__toolbar, 0, wx.LEFT | wx.EXPAND)
21
+ self.SetSizer(sizer)
22
+ @property
23
+ def name(self):
24
+ return self.__name
25
+ @property
26
+ def figure(self):
27
+ return self.__figure
28
+ def configure(self, /, x_label=None, y_label=None, title=None,
29
+ y_log=None, x_log=None, x_range=None, y_range=None):
30
+ if title is not None and isinstance(title, str):
31
+ if len(self.figure.axes)>0:
32
+ self.figure.axes[0].set_title(title)
33
+ self.update()
34
+ @property
35
+ def on_update(self):
36
+ return self.__on_update_func
37
+ @on_update.setter
38
+ def on_update(self, value):
39
+ if value is None or callable(value):
40
+ self.__on_update_func = value
41
+ @property
42
+ def dirty(self):
43
+ return self.__dirty
44
+ def update(self, / , antialiasing=False):
45
+ if antialiasing:
46
+ logging.warn("Antialiasing not supported for matplotlib chart")
47
+ self.__dirty = True
48
+ if self.__on_update_func is not None:
49
+ self.__on_update_func()
50
+ def redraw(self):
51
+ self.antiAlias = False
52
+ self.do_redraw()
53
+ self.__dirty = False
54
+ def do_redraw(self):
55
+ self.canvas.draw()
56
+ def clear(self):
57
+ try:
58
+ self.figure.clf()
59
+ except:
60
+ pass
61
+ pass
62
+ def delete_series(self, name):
63
+ logging.error("Deleting series not supported for matplotlib charts")
64
+ def add_series(self, name):
65
+ logging.error("Use matplotlib API for adding series")
66
+ def get_series(self, name):
67
+ logging.error("Getting series not supported for matplotlib charts")
68
+ return None
69
+ def get_data_as_text(self):
70
+ logging.error("Getting series not supported for matplotlib charts")
71
+ return "Data not available for matplotlib charts"
@@ -4,6 +4,7 @@ from ..panels.panelsbase import PanelCharts_Base
4
4
  from ..charts.scatter_chart import ScatterChart
5
5
  from ..charts.time_chart import TimeChart
6
6
  from ..charts.histogram_chart import HistogramChart
7
+ from ..charts.matplotlib_chart import MatPlotLibChart
7
8
  class PanelCharts( PanelCharts_Base):
8
9
  def __init__( self, parent):
9
10
  super().__init__(parent)
@@ -98,3 +99,10 @@ class PanelCharts( PanelCharts_Base):
98
99
  self.charts[name] = chart
99
100
  self.m_nbkPlots.AddPage( chart, name, True)
100
101
  return chart
102
+ def add_matplotlib(self, name ):
103
+ self.delete_chart(name)
104
+ chart = MatPlotLibChart(self.m_nbkPlots, name)
105
+ chart.on_update = self.update
106
+ self.charts[name] = chart
107
+ self.m_nbkPlots.AddPage( chart, name, True)
108
+ return chart
@@ -69,6 +69,7 @@ class FormMain(FormMain_Base):
69
69
  args["parent"] = self._nbk_control_panels
70
70
  newPanel = panelType(**args)
71
71
  self._nbk_control_panels.AddPage( newPanel, title, False)
72
+ return newPanel
72
73
  def HideCustomPanels(self):
73
74
  if self._nbk_control_panels.GetPageCount()==0:
74
75
  info = self.m_mgr.GetPaneByName("ControlPanels")
@@ -139,6 +139,10 @@ class ScriptGui:
139
139
  if threading.currentThread().getName() == "ScriptThread":
140
140
  return self.__run_with_timer(self.add_histogram, name, binsize)
141
141
  return self._mngr.charts.add_histogram(name, binsize)
142
+ def add_matplotlib(self, name):
143
+ if threading.currentThread().getName() == "ScriptThread":
144
+ return self.__run_with_timer(self.add_matplotlib, name)
145
+ return self._mngr.charts.add_matplotlib(name)
142
146
  def get_chart(self, name):
143
147
  return self._mngr.charts.get_chart(name)
144
148
  def delete_chart(self, name):
@@ -154,7 +154,7 @@ class ScriptManager(object):
154
154
  self.info.set_serials(serials)
155
155
  return serials
156
156
  def add_custom_panel(self, title, panelType, **args):
157
- self.dialog.AddCustomPanel(title, panelType, **args)
157
+ return self.dialog.AddCustomPanel(title, panelType, **args)
158
158
  def run(self):
159
159
  self.dialog.BeforeShow()
160
160
  PrintRedirect.start_redirection(self.loghandler)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: happyscript
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Framework for running scripts
5
5
  Requires-Python: >=3.5
6
6
  Description-Content-Type: text/markdown
@@ -21,6 +21,7 @@ happyscript/charts/__init__.py
21
21
  happyscript/charts/chart.py
22
22
  happyscript/charts/histogram_chart.py
23
23
  happyscript/charts/histogram_series.py
24
+ happyscript/charts/matplotlib_chart.py
24
25
  happyscript/charts/panel_charts.py
25
26
  happyscript/charts/scatter_chart.py
26
27
  happyscript/charts/scatter_series.py
@@ -17,7 +17,7 @@ build-backend = "setuptools.build_meta"
17
17
  [project]
18
18
  name = "happyscript"
19
19
  description = "Framework for running scripts"
20
- version = "0.0.6"
20
+ version = "0.0.7"
21
21
  readme = "README.md"
22
22
  requires-python = ">=3.5"
23
23
  dependencies = [ ]
File without changes
File without changes
File without changes