happyscript 0.0.7__tar.gz → 0.0.8__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 (48) hide show
  1. {happyscript-0.0.7 → happyscript-0.0.8}/PKG-INFO +1 -1
  2. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/__init__.py +1 -1
  3. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/matplotlib_chart.py +15 -4
  4. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/panel_charts.py +2 -0
  5. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptinfo.py +24 -10
  6. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptmanager.py +2 -2
  7. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript.egg-info/PKG-INFO +1 -1
  8. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript.egg-info/SOURCES.txt +1 -0
  9. happyscript-0.0.8/publish.bat +6 -0
  10. {happyscript-0.0.7 → happyscript-0.0.8}/pyproject.toml +1 -1
  11. {happyscript-0.0.7 → happyscript-0.0.8}/README.md +0 -0
  12. {happyscript-0.0.7 → happyscript-0.0.8}/copy_code.py +0 -0
  13. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/__init__.py +0 -0
  14. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/chart.py +0 -0
  15. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/histogram_chart.py +0 -0
  16. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/histogram_series.py +0 -0
  17. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/scatter_chart.py +0 -0
  18. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/scatter_series.py +0 -0
  19. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/time_chart.py +0 -0
  20. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/charts/time_series.py +0 -0
  21. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/form_askchoice.py +0 -0
  22. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/form_askimage.py +0 -0
  23. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/form_main.py +0 -0
  24. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/form_ontestfailure.py +0 -0
  25. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/form_serials.py +0 -0
  26. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/form_stop.py +0 -0
  27. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/forms/formsbase.py +0 -0
  28. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/imglib.py +0 -0
  29. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/panels/panel_log.py +0 -0
  30. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/panels/panel_messages.py +0 -0
  31. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/panels/panel_scripts2.py +0 -0
  32. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/panels/panel_tests.py +0 -0
  33. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/panels/panelsbase.py +0 -0
  34. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptartwork.py +0 -0
  35. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptcontrol.py +0 -0
  36. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptexceptions.py +0 -0
  37. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptgui.py +0 -0
  38. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptparams.py +0 -0
  39. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptreader.py +0 -0
  40. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/scriptrunner.py +0 -0
  41. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/testlog/global_log_handler.py +0 -0
  42. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/testlog/log_to_text.py +0 -0
  43. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/testlog/logtoxml.py +0 -0
  44. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript/testlog/printredirect.py +0 -0
  45. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript.egg-info/dependency_links.txt +0 -0
  46. {happyscript-0.0.7 → happyscript-0.0.8}/happyscript.egg-info/top_level.txt +0 -0
  47. {happyscript-0.0.7 → happyscript-0.0.8}/increment_version.py +0 -0
  48. {happyscript-0.0.7 → happyscript-0.0.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: happyscript
3
- Version: 0.0.7
3
+ Version: 0.0.8
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.7"
1
+ __version__ = "0.0.8"
2
2
  from .scriptmanager import ScriptManager
@@ -1,15 +1,23 @@
1
1
  import logging
2
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
3
+ try:
4
+ from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
5
+ from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as NavigationToolbar
6
+ from matplotlib.figure import Figure
7
+ import matplotlib.pyplot as plt
8
+ HAVE_MATPLOTLIB = True
9
+ except ImportError:
10
+ HAVE_MATPLOTLIB = False
7
11
  class MatPlotLibChart(wx.Panel):
8
12
  def __init__(self, parent_control, name):
9
13
  super().__init__(parent_control, -1)
10
14
  self.__name = name
11
15
  self.__dirty = False
12
16
  self.__on_update_func = None
17
+ if not HAVE_MATPLOTLIB:
18
+ logging.error("Matplotlib is not installed.")
19
+ self.__figure = None
20
+ return
13
21
  self.__figure = Figure(dpi=None, figsize=(2, 2))
14
22
  self.__figure.set_tight_layout(True)
15
23
  self.canvas = FigureCanvas(self, -1, self.__figure)
@@ -27,6 +35,7 @@ class MatPlotLibChart(wx.Panel):
27
35
  return self.__figure
28
36
  def configure(self, /, x_label=None, y_label=None, title=None,
29
37
  y_log=None, x_log=None, x_range=None, y_range=None):
38
+ if not HAVE_MATPLOTLIB: return
30
39
  if title is not None and isinstance(title, str):
31
40
  if len(self.figure.axes)>0:
32
41
  self.figure.axes[0].set_title(title)
@@ -52,8 +61,10 @@ class MatPlotLibChart(wx.Panel):
52
61
  self.do_redraw()
53
62
  self.__dirty = False
54
63
  def do_redraw(self):
64
+ if not HAVE_MATPLOTLIB: return
55
65
  self.canvas.draw()
56
66
  def clear(self):
67
+ if not HAVE_MATPLOTLIB: return
57
68
  try:
58
69
  self.figure.clf()
59
70
  except:
@@ -1,5 +1,6 @@
1
1
  import wx
2
2
  import os
3
+ import logging
3
4
  from ..panels.panelsbase import PanelCharts_Base
4
5
  from ..charts.scatter_chart import ScatterChart
5
6
  from ..charts.time_chart import TimeChart
@@ -102,6 +103,7 @@ class PanelCharts( PanelCharts_Base):
102
103
  def add_matplotlib(self, name ):
103
104
  self.delete_chart(name)
104
105
  chart = MatPlotLibChart(self.m_nbkPlots, name)
106
+ assert chart.figure is not None, "Could not add matplotlib chart."
105
107
  chart.on_update = self.update
106
108
  self.charts[name] = chart
107
109
  self.m_nbkPlots.AddPage( chart, name, True)
@@ -1,10 +1,10 @@
1
1
  import logging, os, time
2
- import yaml
3
2
  class ScriptInfo(object):
4
3
  logger = logging.getLogger('happyscript')
5
- def __init__(self, testlist):
4
+ def __init__(self, testlist, use_yaml:bool):
6
5
  self.clear()
7
6
  self.__dict__["xx_testlist"] = testlist
7
+ self.__dict__["xx_use_yaml"] = use_yaml
8
8
  def clear(self):
9
9
  self.__dict__["xx_info"] = dict()
10
10
  self.__dict__["xx_serials"] = list()
@@ -33,14 +33,28 @@ class ScriptInfo(object):
33
33
  fname = self.xx_filename
34
34
  if fname is None:
35
35
  return
36
- fname = os.path.splitext(fname)[0] + ".yml"
37
- file = open(fname, "w")
38
- if len(self.serials)>0:
39
- serials_dict = { 'serials': self.serials }
40
- yaml.dump(serials_dict, file)
41
- if len(self.xx_info)>0:
42
- yaml.dump(self.xx_info, file)
43
- file.close()
36
+ if self.xx_use_yaml:
37
+ import yaml
38
+ fname = os.path.splitext(fname)[0] + ".yml"
39
+ with open(fname, "w") as file:
40
+ if len(self.serials)>0:
41
+ serials_dict = { 'serials': self.serials }
42
+ yaml.dump(serials_dict, file)
43
+ if len(self.xx_info)>0:
44
+ yaml.dump(self.xx_info, file)
45
+ else:
46
+ import json
47
+ fname = os.path.splitext(fname)[0] + ".json"
48
+ with open(fname, "w", encoding="utf-8") as file:
49
+ if len(self.serials)>0 and len(self.xx_info)>0:
50
+ self.xx_info["serials"] = self.serials
51
+ json.dump(self.xx_info, file, ensure_ascii=False, indent=4)
52
+ del self.xx_info["serials"]
53
+ elif len(self.serials)>0:
54
+ serials_dict = { 'serials': self.serials }
55
+ json.dump(serials_dict, file, ensure_ascii=False, indent=4)
56
+ elif len(self.xx_info)>0:
57
+ json.dump(self.xx_info, file, ensure_ascii=False, indent=4)
44
58
  def update_file(self, force=False):
45
59
  if len(self.xx_info)==0 and len(self.serials)==0:
46
60
  return
@@ -34,7 +34,7 @@ class TestLogHandler(logging.FileHandler):
34
34
  class ScriptManager(object):
35
35
  dialog = None
36
36
  logger = logging.getLogger("happyscript")
37
- def __init__(self, title=None, colors = None):
37
+ def __init__(self, title=None, colors = None, use_yaml=False):
38
38
  fixedcolors = [ (226, 239, 217), (222, 235, 246), (255, 242, 204), (237, 237, 237),
39
39
  (251, 229, 213), (217, 226, 243) ]
40
40
  self.on_batch_start = None
@@ -58,7 +58,7 @@ class ScriptManager(object):
58
58
  self.ctrl = ScriptControl()
59
59
  self.gui = ScriptGui(self)
60
60
  self.dialog.on_gui_timer = self.gui.on_gui_timer
61
- self.info = ScriptInfo( self.dialog.pnlTests )
61
+ self.info = ScriptInfo( self.dialog.pnlTests, use_yaml )
62
62
  self._script_params = ScriptParams(self.gui)
63
63
  self._script_params.on_add_object = self._on_add_object
64
64
  self._script_readers = dict()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: happyscript
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: Framework for running scripts
5
5
  Requires-Python: >=3.5
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,7 @@
1
1
  README.md
2
2
  copy_code.py
3
3
  increment_version.py
4
+ publish.bat
4
5
  pyproject.toml
5
6
  happyscript/__init__.py
6
7
  happyscript/imglib.py
@@ -0,0 +1,6 @@
1
+ python copy_code.py
2
+ python increment_version.py
3
+ python -m build
4
+ pause
5
+ twine upload dist/* --repository happyscript
6
+ pause
@@ -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.7"
20
+ version = "0.0.8"
21
21
  readme = "README.md"
22
22
  requires-python = ">=3.5"
23
23
  dependencies = [ ]
File without changes
File without changes
File without changes