happyscript 0.0.11__tar.gz → 0.0.13__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 (52) hide show
  1. {happyscript-0.0.11 → happyscript-0.0.13}/PKG-INFO +1 -1
  2. {happyscript-0.0.11 → happyscript-0.0.13}/copy_code.py +6 -4
  3. happyscript-0.0.13/happyscript/__init__.py +3 -0
  4. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptinfo.py +4 -2
  5. happyscript-0.0.13/happyscript/splashmenu/forms.py +30 -0
  6. happyscript-0.0.13/happyscript/splashmenu/splashmenuform.py +97 -0
  7. happyscript-0.0.13/happyscript/splashmenu/splashmenumain.py +31 -0
  8. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript.egg-info/PKG-INFO +1 -1
  9. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript.egg-info/SOURCES.txt +3 -0
  10. {happyscript-0.0.11 → happyscript-0.0.13}/pyproject.toml +1 -1
  11. happyscript-0.0.11/happyscript/__init__.py +0 -2
  12. {happyscript-0.0.11 → happyscript-0.0.13}/README.md +0 -0
  13. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/__init__.py +0 -0
  14. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/chart.py +0 -0
  15. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/histogram_chart.py +0 -0
  16. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/histogram_series.py +0 -0
  17. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/matplotlib_chart.py +0 -0
  18. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/panel_charts.py +0 -0
  19. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/scatter_chart.py +0 -0
  20. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/scatter_series.py +0 -0
  21. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/time_chart.py +0 -0
  22. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/charts/time_series.py +0 -0
  23. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/form_askchoice.py +0 -0
  24. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/form_askimage.py +0 -0
  25. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/form_main.py +0 -0
  26. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/form_ontestfailure.py +0 -0
  27. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/form_serials.py +0 -0
  28. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/form_stop.py +0 -0
  29. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/forms/formsbase.py +0 -0
  30. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/imglib.py +0 -0
  31. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/panels/panel_log.py +0 -0
  32. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/panels/panel_messages.py +0 -0
  33. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/panels/panel_scripts2.py +0 -0
  34. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/panels/panel_tests.py +0 -0
  35. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/panels/panelsbase.py +0 -0
  36. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptartwork.py +0 -0
  37. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptcontrol.py +0 -0
  38. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptexceptions.py +0 -0
  39. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptgui.py +0 -0
  40. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptmanager.py +0 -0
  41. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptparams.py +0 -0
  42. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptreader.py +0 -0
  43. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/scriptrunner.py +0 -0
  44. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/testlog/global_log_handler.py +0 -0
  45. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/testlog/log_to_text.py +0 -0
  46. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/testlog/logtoxml.py +0 -0
  47. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript/testlog/printredirect.py +0 -0
  48. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript.egg-info/dependency_links.txt +0 -0
  49. {happyscript-0.0.11 → happyscript-0.0.13}/happyscript.egg-info/top_level.txt +0 -0
  50. {happyscript-0.0.11 → happyscript-0.0.13}/increment_version.py +0 -0
  51. {happyscript-0.0.11 → happyscript-0.0.13}/publish.bat +0 -0
  52. {happyscript-0.0.11 → happyscript-0.0.13}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: happyscript
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Framework for running scripts
5
5
  Requires-Python: >=3.5
6
6
  Description-Content-Type: text/markdown
@@ -182,10 +182,12 @@ def copy_all_code():
182
182
 
183
183
  print(f"Copying file {name}")
184
184
 
185
- # copy_full(old_file,new_file)
186
- # copy_minified(old_file,new_file)
187
- copy_without_comments(old_file,new_file)
188
-
185
+ if old_file.endswith('.py'):
186
+ # copy_full(old_file,new_file)
187
+ # copy_minified(old_file,new_file)
188
+ copy_without_comments(old_file,new_file)
189
+ else:
190
+ shutil.copyfile(old_file, new_file)
189
191
 
190
192
  if __name__=="__main__":
191
193
  delete_old_code()
@@ -0,0 +1,3 @@
1
+ __version__ = "0.0.13"
2
+ from .scriptmanager import ScriptManager
3
+ from .splashmenu.splashmenumain import SplashMenu
@@ -67,13 +67,15 @@ class ScriptInfo(object):
67
67
  def serials(self):
68
68
  return self.xx_serials.copy()
69
69
  def __getattr__(self, attr):
70
- if attr in self.xx_info:
71
- return self.xx_info[attr]
70
+ if attr.lower() in self.xx_info:
71
+ return self.xx_info[attr.lower()]
72
72
  else:
73
73
  return None
74
74
  def __setattr__(self, attr, value):
75
75
  if attr in self.__dict__:
76
76
  super().__setattr__(attr, value)
77
+ elif attr.lower() in self.__dict__:
78
+ super().__setattr__(attr.lower(), value)
77
79
  else:
78
80
  self.add(attr, value)
79
81
  def get_passed_tests(self, include = None, exclude = None):
@@ -0,0 +1,30 @@
1
+ import wx
2
+ import wx.xrc
3
+ class SplashMenuMain_Base ( wx.Frame ):
4
+ def __init__( self, parent ):
5
+ wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Menu", pos = wx.DefaultPosition, size = wx.Size( 629,523 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.FRAME_SHAPED|wx.MINIMIZE_BOX|wx.RESIZE_BORDER|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL )
6
+ self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
7
+ bSizer16 = wx.BoxSizer( wx.VERTICAL )
8
+ gSizer2 = wx.GridSizer( 2, 3, 0, 0 )
9
+ self.m_bpButton2 = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|0 )
10
+ gSizer2.Add( self.m_bpButton2, 0, wx.ALL, 5 )
11
+ self.m_bpButton3 = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|0 )
12
+ gSizer2.Add( self.m_bpButton3, 0, wx.ALL, 5 )
13
+ self.m_bpButton4 = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|0 )
14
+ gSizer2.Add( self.m_bpButton4, 0, wx.ALL, 5 )
15
+ gSizer2.Add( ( 0, 0), 1, wx.EXPAND, 5 )
16
+ self.m_button24 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 )
17
+ gSizer2.Add( self.m_button24, 0, wx.ALL, 5 )
18
+ self.m_bpButton1 = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|0 )
19
+ self.m_bpButton1.SetBitmap( wx.Bitmap( u"exit.png", wx.BITMAP_TYPE_ANY ) )
20
+ gSizer2.Add( self.m_bpButton1, 0, wx.ALL|wx.EXPAND, 20 )
21
+ bSizer16.Add( gSizer2, 1, wx.EXPAND, 5 )
22
+ self.SetSizer( bSizer16 )
23
+ self.Layout()
24
+ self.m_statusBar2 = self.CreateStatusBar( 1, wx.STB_SIZEGRIP, wx.ID_ANY )
25
+ self.Centre( wx.BOTH )
26
+ self.m_bpButton1.Bind( wx.EVT_BUTTON, self.DoExit )
27
+ def __del__( self ):
28
+ pass
29
+ def DoExit( self, event ):
30
+ event.Skip()
@@ -0,0 +1,97 @@
1
+ import wx
2
+ import os, sys, subprocess
3
+ __curdir = os.path.dirname(os.path.realpath(__file__))
4
+ def localfile(filename):
5
+ return os.path.join(__curdir, filename)
6
+ class SplashMenuForm( wx.Frame ):
7
+ def __init__(self, num_x, num_y, border = 50):
8
+ if num_x<1: num_x = 2
9
+ if num_y<1: num_y = 1
10
+ self.num_x = num_x
11
+ self.num_y = num_y
12
+ wx.Frame.__init__ ( self, None, id = wx.ID_ANY, title = u"Menu", pos = wx.DefaultPosition, size = wx.Size( 629,523 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.FRAME_SHAPED|wx.MINIMIZE_BOX|wx.RESIZE_BORDER|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL )
13
+ self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
14
+ disp = wx.Display(wx.Display.GetFromWindow(self))
15
+ (x1, y1, sx, sy) = disp.GetGeometry()
16
+ if border < 0: border = 30
17
+ if border*3 > sx or border*3 > sy: border = min(sx//6,sy//6)
18
+ sx -= 2*border
19
+ sy -= 2*border
20
+ self.SetSize( x1 + border, y1 + border, sx, sy)
21
+ bSizer16 = wx.BoxSizer( wx.VERTICAL )
22
+ gSizer2 = wx.GridSizer( num_y, num_x, 0, 0 )
23
+ self.buttons = list()
24
+ self.programs = dict()
25
+ self.arguments = dict()
26
+ for y in range(num_y):
27
+ for x in range(num_x):
28
+ if y==num_y-1 and x==num_x-1:
29
+ break
30
+ btn = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|0, name=f"{x},{y}" )
31
+ btn.location = (x+1,y+1)
32
+ gSizer2.Add( btn, 0, wx.ALL|wx.EXPAND, 5 )
33
+ self.buttons.append(btn)
34
+ self.btnExit = wx.BitmapButton( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|0 )
35
+ gSizer2.Add( self.btnExit, 0, wx.ALL|wx.EXPAND, 20 )
36
+ bSizer16.Add( gSizer2, 1, wx.EXPAND, 5 )
37
+ self.SetSizer( bSizer16 )
38
+ self.Layout()
39
+ self.m_statusBar2 = self.CreateStatusBar( 1, wx.STB_SIZEGRIP, wx.ID_ANY )
40
+ self.Centre( wx.BOTH )
41
+ for btn in self.buttons:
42
+ btn.Hide()
43
+ btn.Bind( wx.EVT_BUTTON, self.OnButton )
44
+ self.SetButtonImage( self.btnExit, localfile("exit.png") )
45
+ self.btnExit.Bind( wx.EVT_BUTTON, self.DoExit )
46
+ def DoExit( self, event ):
47
+ self.Destroy()
48
+ wx.GetApp().ExitMainLoop()
49
+ def SetButtonImage(self, btn, filename):
50
+ margin = 10
51
+ img = wx.Image(filename, type=wx.BITMAP_TYPE_ANY)
52
+ isize = img.GetSize()
53
+ bsize = btn.GetSize()
54
+ fx = (bsize.x-margin) / isize.x
55
+ fy = (bsize.y-margin) / isize.y
56
+ factor = min(fx,fy)
57
+ img_x = int(isize.x * factor)
58
+ img_y = int(isize.y * factor)
59
+ img = img.Scale(img_x, img_y)
60
+ bitmap = img.ConvertToBitmap()
61
+ btn.SetBitmap( bitmap )
62
+ def ReturnButton(self, x, y):
63
+ return self.buttons[ (x-1) + (y-1)*self.num_x]
64
+ def set_button(self, x, y, image, program, arguments):
65
+ if x<1 or x>self.num_x or y<1 or y>self.num_y or (x==self.num_x and y==self.num_y ):
66
+ raise ValueError(f"position {x} {y} is not a valid button position")
67
+ btn = self.ReturnButton(x,y)
68
+ self.SetButtonImage(btn, image)
69
+ btn.Show()
70
+ self.programs[(x,y)] = program
71
+ self.arguments[(x,y)] = arguments
72
+ def OnButton(self, event ):
73
+ btn = event.GetEventObject()
74
+ if btn.location not in self.programs:
75
+ raise ValueError(f"Strange... nothing to do for button {btn.location}")
76
+ program = self.programs[btn.location]
77
+ arguments = self.arguments[btn.location]
78
+ self.Hide()
79
+ try:
80
+ cmd = [ sys.executable, program]
81
+ cmd.extend(arguments)
82
+ os.chdir( os.path.dirname(program) )
83
+ result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
84
+ for line in result.stdout.decode("utf-8").splitlines():
85
+ print(line)
86
+ for line in result.stderr.decode("utf-8").splitlines():
87
+ print(line)
88
+ except FileNotFoundError as exc:
89
+ print(f"Process failed because the executable could not be found.\n{exc}")
90
+ except subprocess.CalledProcessError as exc:
91
+ print(
92
+ f"Process failed because did not return a successful return code. "
93
+ f"Returned {exc.returncode}\n{exc}"
94
+ )
95
+ finally:
96
+ self.Show()
97
+ self.Raise()
@@ -0,0 +1,31 @@
1
+ import os
2
+ class SplashMenu():
3
+ def __init__(self, mainfilename, num_x, num_y, border = 50):
4
+ import wx
5
+ from .splashmenuform import SplashMenuForm
6
+ self.mainfile = mainfilename
7
+ self.maindir = os.path.dirname(os.path.abspath(mainfilename))
8
+ self.app = wx.App()
9
+ self.top = SplashMenuForm(num_x, num_y, border)
10
+ def set_button(self, x, y, image, program, arguments=None):
11
+ imgfile = os.path.join(self.maindir, image)
12
+ if not os.path.exists(imgfile):
13
+ imgfile = os.path.abspath(image)
14
+ if not os.path.exists(imgfile):
15
+ raise ValueError( f"Could not find file {image}")
16
+ progfile = os.path.join(self.maindir, program)
17
+ if not os.path.exists(progfile):
18
+ progfile = os.path.abspath(program)
19
+ if not os.path.exists(progfile):
20
+ raise ValueError( f"Could not find file {program}")
21
+ if arguments is None:
22
+ arguments = list()
23
+ elif type(arguments) is not list:
24
+ arguments = [ arguments ]
25
+ for i in range(0,len(arguments)):
26
+ if type(arguments[i]) is not str:
27
+ arguments[i] = str(arguments[i])
28
+ self.top.set_button(x, y, imgfile, progfile, arguments)
29
+ def run(self):
30
+ self.top.Show()
31
+ self.app.MainLoop()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: happyscript
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Framework for running scripts
5
5
  Requires-Python: >=3.5
6
6
  Description-Content-Type: text/markdown
@@ -40,6 +40,9 @@ happyscript/panels/panel_messages.py
40
40
  happyscript/panels/panel_scripts2.py
41
41
  happyscript/panels/panel_tests.py
42
42
  happyscript/panels/panelsbase.py
43
+ happyscript/splashmenu/forms.py
44
+ happyscript/splashmenu/splashmenuform.py
45
+ happyscript/splashmenu/splashmenumain.py
43
46
  happyscript/testlog/global_log_handler.py
44
47
  happyscript/testlog/log_to_text.py
45
48
  happyscript/testlog/logtoxml.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.11"
20
+ version = "0.0.13"
21
21
  readme = "README.md"
22
22
  requires-python = ">=3.5"
23
23
  dependencies = [ ]
@@ -1,2 +0,0 @@
1
- __version__ = "0.0.11"
2
- from .scriptmanager import ScriptManager
File without changes
File without changes
File without changes