happyscript 0.0.10__tar.gz → 0.0.12__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.
- {happyscript-0.0.10 → happyscript-0.0.12}/PKG-INFO +1 -1
- {happyscript-0.0.10 → happyscript-0.0.12}/copy_code.py +6 -4
- happyscript-0.0.12/happyscript/__init__.py +3 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/panels/panel_scripts2.py +12 -3
- happyscript-0.0.12/happyscript/splashmenu/forms.py +30 -0
- happyscript-0.0.12/happyscript/splashmenu/splashmenuform.py +97 -0
- happyscript-0.0.12/happyscript/splashmenu/splashmenumain.py +31 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript.egg-info/PKG-INFO +1 -1
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript.egg-info/SOURCES.txt +3 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/pyproject.toml +1 -1
- happyscript-0.0.10/happyscript/__init__.py +0 -2
- {happyscript-0.0.10 → happyscript-0.0.12}/README.md +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/__init__.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/chart.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/histogram_chart.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/histogram_series.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/matplotlib_chart.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/panel_charts.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/scatter_chart.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/scatter_series.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/time_chart.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/charts/time_series.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/form_askchoice.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/form_askimage.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/form_main.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/form_ontestfailure.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/form_serials.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/form_stop.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/forms/formsbase.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/imglib.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/panels/panel_log.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/panels/panel_messages.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/panels/panel_tests.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/panels/panelsbase.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptartwork.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptcontrol.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptexceptions.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptgui.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptinfo.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptmanager.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptparams.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptreader.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/scriptrunner.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/testlog/global_log_handler.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/testlog/log_to_text.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/testlog/logtoxml.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript/testlog/printredirect.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript.egg-info/dependency_links.txt +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/happyscript.egg-info/top_level.txt +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/increment_version.py +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/publish.bat +0 -0
- {happyscript-0.0.10 → happyscript-0.0.12}/setup.cfg +0 -0
|
@@ -182,10 +182,12 @@ def copy_all_code():
|
|
|
182
182
|
|
|
183
183
|
print(f"Copying file {name}")
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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()
|
|
@@ -8,11 +8,20 @@ class PanelScripts2( PanelScripts_Base):
|
|
|
8
8
|
self.tree_root = self.treeScripts.AddRoot("DUMMY")
|
|
9
9
|
self.load_treeview()
|
|
10
10
|
def load_treeview(self):
|
|
11
|
-
self.treeScripts
|
|
11
|
+
tree = self.treeScripts
|
|
12
|
+
expanded_files = list()
|
|
13
|
+
(child, cookie) = tree.GetFirstChild(self.tree_root)
|
|
14
|
+
while child.IsOk():
|
|
15
|
+
if tree.IsExpanded(child):
|
|
16
|
+
expanded_files.append(tree.GetItemText(child))
|
|
17
|
+
(child, cookie) = tree.GetNextChild(self.tree_root, cookie)
|
|
18
|
+
tree.DeleteChildren(self.tree_root)
|
|
12
19
|
for modname in self._reader.get_file_list():
|
|
13
|
-
child =
|
|
20
|
+
child = tree.AppendItem(self.tree_root, modname)
|
|
14
21
|
for funcname in self._reader.get_func_names(modname):
|
|
15
|
-
|
|
22
|
+
tree.AppendItem(child, funcname)
|
|
23
|
+
if modname in expanded_files:
|
|
24
|
+
tree.Expand(child)
|
|
16
25
|
def OnBtnReload( self, event ):
|
|
17
26
|
if self._script_ctrl.is_busy():
|
|
18
27
|
msg = "A script is still running. Press 'abort' first."
|
|
@@ -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()
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|