VIStk 0.3.6__tar.gz → 0.3.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.

Potentially problematic release.


This version of VIStk might be problematic. Click here for more details.

Files changed (51) hide show
  1. {vistk-0.3.6/VIStk.egg-info → vistk-0.3.7}/PKG-INFO +1 -1
  2. vistk-0.3.7/VIS/Form.zip +0 -0
  3. {vistk-0.3.6 → vistk-0.3.7}/VIS/Templates/screen.txt +0 -2
  4. vistk-0.3.7/VIS/VIS.py +55 -0
  5. vistk-0.3.7/VIS/project.py +284 -0
  6. {vistk-0.3.6 → vistk-0.3.7}/VIS/release.py +3 -3
  7. {vistk-0.3.6 → vistk-0.3.7/VIStk.egg-info}/PKG-INFO +1 -1
  8. {vistk-0.3.6 → vistk-0.3.7}/VIStk.egg-info/SOURCES.txt +0 -4
  9. {vistk-0.3.6 → vistk-0.3.7}/changelog.md +6 -0
  10. vistk-0.3.7/knownissues.md +30 -0
  11. {vistk-0.3.6 → vistk-0.3.7}/pyproject.toml +1 -1
  12. vistk-0.3.6/VIS/Form.zip +0 -0
  13. vistk-0.3.6/VIS/VIS.py +0 -96
  14. vistk-0.3.6/VIS/elements.py +0 -27
  15. vistk-0.3.6/VIS/patch.py +0 -11
  16. vistk-0.3.6/VIS/project.py +0 -16
  17. vistk-0.3.6/VIS/screen.py +0 -15
  18. vistk-0.3.6/VIS/stitch.py +0 -37
  19. vistk-0.3.6/knownissues.md +0 -11
  20. {vistk-0.3.6 → vistk-0.3.7}/.github/workflows/publish.yml +0 -0
  21. {vistk-0.3.6 → vistk-0.3.7}/.gitignore +0 -0
  22. {vistk-0.3.6 → vistk-0.3.7}/Form/Icons/VIS.ico +0 -0
  23. {vistk-0.3.6 → vistk-0.3.7}/Form/README.txt +0 -0
  24. {vistk-0.3.6 → vistk-0.3.7}/Form/Screens/__init__.py +0 -0
  25. {vistk-0.3.6 → vistk-0.3.7}/Form/Screens/root.py +0 -0
  26. {vistk-0.3.6 → vistk-0.3.7}/Form/Screens/styles.py +0 -0
  27. {vistk-0.3.6 → vistk-0.3.7}/Form/modules/__init__.py +0 -0
  28. {vistk-0.3.6 → vistk-0.3.7}/LICENSE +0 -0
  29. {vistk-0.3.6 → vistk-0.3.7}/README.md +0 -0
  30. {vistk-0.3.6 → vistk-0.3.7}/Untitled.xcf +0 -0
  31. {vistk-0.3.6 → vistk-0.3.7}/VIS/Templates/collect.txt +0 -0
  32. {vistk-0.3.6 → vistk-0.3.7}/VIS/Templates/f_element.txt +0 -0
  33. {vistk-0.3.6 → vistk-0.3.7}/VIS/Templates/spec.txt +0 -0
  34. {vistk-0.3.6 → vistk-0.3.7}/VIS/__init__.py +0 -0
  35. {vistk-0.3.6 → vistk-0.3.7}/VIS/__pycache__/__init__.cpython-313.pyc +0 -0
  36. {vistk-0.3.6 → vistk-0.3.7}/VIS/menu.py +0 -0
  37. {vistk-0.3.6 → vistk-0.3.7}/VIStk.egg-info/dependency_links.txt +0 -0
  38. {vistk-0.3.6 → vistk-0.3.7}/VIStk.egg-info/entry_points.txt +0 -0
  39. {vistk-0.3.6 → vistk-0.3.7}/VIStk.egg-info/requires.txt +0 -0
  40. {vistk-0.3.6 → vistk-0.3.7}/VIStk.egg-info/top_level.txt +0 -0
  41. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/VIS.cpython-313.pyc +0 -0
  42. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/__init__.cpython-313.pyc +0 -0
  43. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/cleanup.cpython-313.pyc +0 -0
  44. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/elements.cpython-313.pyc +0 -0
  45. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/menu.cpython-313.pyc +0 -0
  46. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/patch.cpython-313.pyc +0 -0
  47. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/project.cpython-313.pyc +0 -0
  48. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/screen.cpython-313.pyc +0 -0
  49. {vistk-0.3.6 → vistk-0.3.7}/__pycache__/stitch.cpython-313.pyc +0 -0
  50. {vistk-0.3.6 → vistk-0.3.7}/documentation.md +0 -0
  51. {vistk-0.3.6 → vistk-0.3.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: VIStk
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: Visual Interfacing Structure for python using tkinter
5
5
  Author-email: Elijah Love <elijah2005l@gmail.com>
6
6
  Maintainer-email: Elijah Love <elijah2005l@gmail.com>
Binary file
@@ -6,8 +6,6 @@ import sys
6
6
  #File Specific Imports
7
7
 
8
8
  #Configure Screen
9
- print(cfp)
10
-
11
9
  w = 1080
12
10
  h = 720
13
11
  ws = root.winfo_screenwidth()
vistk-0.3.7/VIS/VIS.py ADDED
@@ -0,0 +1,55 @@
1
+ import sys
2
+ import os
3
+ import zipfile
4
+ import subprocess
5
+ import shutil
6
+ from VIS.project import *
7
+ from importlib import metadata
8
+ import json
9
+
10
+
11
+
12
+ inp = sys.argv
13
+ print(f"VIS Version {metadata.version("VIStk")}")
14
+
15
+
16
+ #Copied from source https://stackoverflow.com/a/75246706
17
+ def unzip_without_overwrite(src_path, dst_dir):
18
+ with zipfile.ZipFile(src_path, "r") as zf:
19
+ for member in zf.infolist():
20
+ file_path = os.path.join(dst_dir, member.filename)
21
+ if not os.path.exists(file_path):
22
+ zf.extract(member, dst_dir)
23
+ def __main__():
24
+ match inp[1]:
25
+ case "new"|"New"|"N"|"n":#Create a new VIS project
26
+ project = VINFO()
27
+
28
+ case "add" | "Add" | "a" | "A":
29
+ project = Project()
30
+ match inp[2]:
31
+ case "screen" | "Screen" | "s" | "S":
32
+ if not inp[3] == None:
33
+ screen = project.verScreen(inp[3])
34
+ if len(inp) >= 5:
35
+ match inp[4]:
36
+ case "menu" | "Menu" | "m" | "M":
37
+ screen.addMenu(inp[5])
38
+ case "elements" | "Elements" | "e" | "E":
39
+ for i in inp[5].split("-"):
40
+ screen.addElement(i)
41
+ screen.stitch()
42
+ else:
43
+ project.newScreen(inp[3])
44
+
45
+ case "stitch" | "Stitch" | "s" | "S":
46
+ project = Project()
47
+ screen = project.getScreen(inp[2])
48
+ if not screen == None:
49
+ screen.stitch()
50
+ else:
51
+ print("Screen does not exist")
52
+
53
+ case "release" | "Release" | "r" | "R":
54
+ project = VINFO()
55
+ subprocess.call("python " + project.p_vis+"/release.py " + inp[2])
@@ -0,0 +1,284 @@
1
+ import os
2
+ import json
3
+ import zipfile
4
+ import shutil
5
+ import re
6
+ import glob
7
+ import subprocess
8
+
9
+ #Copied from source
10
+ #https://stackoverflow.com/a/75246706
11
+ def unzip_without_overwrite(src_path, dst_dir):
12
+ with zipfile.ZipFile(src_path, "r") as zf:
13
+ for member in zf.infolist():
14
+ file_path = os.path.join(dst_dir, member.filename)
15
+ if not os.path.exists(file_path):
16
+ zf.extract(member, dst_dir)
17
+
18
+ def getPath():
19
+ """Searches for .VIS folder and returns from path.cfg
20
+ """
21
+ sto = 0
22
+ while True:
23
+ try:
24
+ step=""
25
+ for i in range(0,sto,1): #iterate on sto to step backwards and search for project info
26
+ step = "../" + step
27
+ if os.path.exists(step+".VIS/"):
28
+ return open(step+".VIS/path.cfg","r").read().replace("\\","/") #return stored path
29
+ else:
30
+ if os.path.exists(step):
31
+ sto += 1
32
+ else:
33
+ return None #return none if cant escape more
34
+ except:
35
+ return None #if failed return none
36
+
37
+ def validName(name:str):
38
+ """Checks if provided path is a valid filename
39
+ """
40
+ if " " in name:
41
+ print("Cannot have spaces in file name.")
42
+ return False
43
+ if "/" in name or "\\" in name:
44
+ print("Cannot have filepath deliminator in file name.")
45
+ return False
46
+ if "<" in name or ">" in name or ":" in name or '"' in name or "|" in name or "?" in name or "*" in name:
47
+ print('Invlaid ASCII characters for windows file creation, please remove all <>:"|?* from file name.')
48
+ return False
49
+ if name.split(".")[0] in ["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]:
50
+ print(f"Filename {name} reserved by OS.")
51
+ return False
52
+ if "" == name:
53
+ print("Must provide a name for file.")
54
+ return False
55
+ else:
56
+ return True
57
+
58
+
59
+ class VINFO():
60
+ """Overarching control structure within the /.VIS/ folder
61
+ """
62
+ def __init__(self):
63
+ if getPath() == None:
64
+ wd = os.getcwd()
65
+ os.mkdir(wd+"\\.VIS")
66
+ open(wd+"/.VIS/path.cfg","w").write(wd) if os.path.exists(wd+"/.VIS/path.cfg") else open(wd+"/.VIS/path.cfg", 'a').write(wd)
67
+ print(f"Stored project path in path.cfg as {wd} in {wd}/.VIS/path.cfg")
68
+
69
+ unzip_without_overwrite("./Form.zip",wd)
70
+ print(f"Copied structure to {wd}")
71
+
72
+ shutil.copytree("./Templates",wd+"/.VIS/Templates",dirs_exist_ok=True)
73
+ print(f"Loaded default templates into {wd}/.VIS/Templates/")
74
+
75
+
76
+ #DO NOT MESS WITH THE TEMPLATE HEADERS
77
+
78
+ title = input("Enter a name for the VIS project: ")
79
+
80
+ info = {}
81
+ info[title] = {}
82
+ info[title]["Screens"]={}
83
+ info[title]["defaults"]={}
84
+ info[title]["defaults"]["icon"]="VIS"#default icon
85
+ with open(wd+"/.VIS/project.json","w") as f:
86
+ f.write("{}")
87
+ json.dump(info,f,indent=4)
88
+ print(f"Setup project.json for project {title} in {wd}/.VIS/")
89
+
90
+
91
+ #Need to get current python location where VIS is installed
92
+ self.p_vis = subprocess.check_output('python -c "import os, sys; print(os.path.dirname(sys.executable))"').decode().strip("\r\n")+"\\Lib\\site-packages\\VIS\\"
93
+
94
+
95
+ self.p_project = getPath()
96
+ self.p_vinfo = self.p_project + "/.VIS"
97
+ self.p_sinfo = self.p_vinfo + "/project.json"
98
+ with open(self.p_sinfo,"r") as f: self.title = list(json.load(f).keys())[0]
99
+ self.p_screens = self.p_project +"/Screens"
100
+ self.p_modules = self.p_project +"/modules"
101
+ self.p_templates = self.p_vinfo + "/Templates"
102
+ self.screenlist=[]
103
+
104
+ class Screen(VINFO):
105
+ """A VIS screen object
106
+ """
107
+ def __init__(self,name:str,script:str,release:bool=False,icon:str=None,exists:bool=True):
108
+ super().__init__()
109
+ self.name=name
110
+ self.script=script
111
+ self.release=release
112
+ self.icon=icon
113
+ self.path = self.p_screens+"/"+name
114
+ self.m_path = self.p_modules+"/"+name
115
+
116
+ if not exists:
117
+ with open(self.p_sinfo,"r") as f:
118
+ info = json.load(f)
119
+
120
+ info[self.title]["Screens"][name] = {"script":script,"release":release}
121
+ if not icon == None:
122
+ info[self.title]["Screens"][name]["icon"] = icon
123
+
124
+ with open(self.p_sinfo,"w") as f:
125
+ json.dump(info,f,indent=4)
126
+
127
+ shutil.copyfile(self.p_templates+"/screen.txt",self.p_project+"/"+script)
128
+ os.mkdir(self.p_screens+"/"+name)
129
+ os.mkdir(self.p_modules+"/"+name)
130
+ #can use this info to create something about a new screen
131
+
132
+ def addElement(self,element:str) -> int:
133
+ if validName(element):
134
+ if not os.path.exists(self.path+"/f_"+element+".py"):
135
+ shutil.copyfile(self.p_templates+"/f_element.txt",self.path+"/f_"+element+".py")
136
+ print(f"Created element f_{element}.py in {self.path}")
137
+ self.patch(element)
138
+ if not os.path.exists(self.m_path+"/m_"+element+".py"):
139
+ with open(self.m_path+"/m_"+element+".py", "w"): pass
140
+ print(f"Created module m_{element}.py in {self.m_path}")
141
+ return 1
142
+ else:
143
+ return 0
144
+
145
+ def addMenu(self,menu:str) -> int:
146
+ pass #will be command line menu creation tool
147
+
148
+ def patch(self,element:str) -> int:
149
+ """Patches up the template after its copied
150
+ """
151
+ if os.path.exists(self.path+"/f_"+element+".py"):
152
+ with open(self.path+"/f_"+element+".py","r") as f:
153
+ text = f.read()
154
+ text = text.replace("<frame>","f_"+element)
155
+ with open(self.path+"/f_"+element+".py","w") as f:
156
+ f.write(text)
157
+ print(f"patched f_{element}.py")
158
+ return 1
159
+ else:
160
+ print(f"Could not patch, element does not exist.")
161
+ return 0
162
+
163
+ def stitch(self) -> int:
164
+ """Connects screen elements to a screen
165
+ """
166
+ with open(self.p_project+"/"+self.script,"r") as f: text = f.read()
167
+ stitched = []
168
+ #Elements
169
+ pattern = r"#Screen Elements.*#Screen Grid"
170
+
171
+ elements = glob.glob(self.path+'/f_*')#get all elements
172
+ for i in range(0,len(elements),1):#iterate into module format
173
+ elements[i] = elements[i].replace("\\","/")
174
+ elements[i] = elements[i].replace(self.path+"/","Screens."+self.name+".")[:-3]
175
+ stitched.append(elements[i])
176
+ #combine and change text
177
+ elements = "from " + " import *\nfrom ".join(elements) + " import *\n"
178
+ text = re.sub(pattern, "#Screen Elements\n" + elements + "\n#Screen Grid", text, flags=re.DOTALL)
179
+
180
+ #Modules
181
+ pattern = r"#Screen Modules.*#Handle Arguments"
182
+
183
+ modules = glob.glob(self.m_path+'/m_*')#get all modules
184
+ for i in range(0,len(modules),1):#iterate into module format
185
+ modules[i] = modules[i].replace("\\","/")
186
+ modules[i] = modules[i].replace(self.m_path+"/","modules."+self.name+".")[:-3]
187
+ stitched.append(modules[i])
188
+ #combine and change text
189
+ modules = "from " + " import *\nfrom ".join(modules) + " import *\n"
190
+ text = re.sub(pattern, "#Screen Modules\n" + modules + "\n#Handle Arguments", text, flags=re.DOTALL)
191
+
192
+ #write out
193
+ with open(self.p_project+"/"+self.script,"w") as f:
194
+ f.write(text)
195
+ print("Stitched: ")
196
+ for i in stitched:
197
+ print(f"\t{i} to {self.name}")
198
+
199
+
200
+ class Project(VINFO):
201
+ """VIS Project Object
202
+ """
203
+ def __init__(self):
204
+ """Initializes or load a VIS project
205
+ """
206
+ super().__init__()
207
+ with open(self.p_sinfo,"r") as f:
208
+ info = json.load(f)
209
+ self.name = list(info.keys())[0]
210
+
211
+ for screen in list(info[self.name]["Screens"].keys()):
212
+ scr = Screen(screen,
213
+ info[self.name]["Screens"][screen]["script"],
214
+ info[self.name]["Screens"][screen]["release"],
215
+ info[self.name]["Screens"][screen].get("icon"))
216
+ self.screenlist.append(scr)
217
+
218
+ def newScreen(self,screen:str) -> int:
219
+ """Creates a new screen with some prompting
220
+
221
+ Returns:
222
+ 0 Failed
223
+ 1 Success
224
+ """
225
+ #Check for valid filename
226
+ if not validName(screen):
227
+ return 0
228
+
229
+ with open(self.p_sinfo,"r") as f:
230
+ info = json.load(f) #Load info
231
+
232
+ name = self.title
233
+ if info[name]["Screens"].get(screen) == None: #If Screen does not exist in VINFO
234
+ while True: #ensures a valid name is used for script
235
+ match input(f"Should python script use name {screen}.py? "):
236
+ case "Yes" | "yes" | "Y" | "y":
237
+ script = screen + ".py"
238
+ break
239
+ case _:
240
+ script = input("Enter the name for the script file: ").strip(".py")+".py"
241
+ if validName(script):
242
+ break
243
+
244
+ match input("Should this screen have its own .exe?: "):
245
+ case "Yes" | "yes" | "Y" | "y":
246
+ release = True
247
+ case _:
248
+ release = False
249
+ ictf =input("What is the icon for this screen (or none)?: ")
250
+ icon = ictf.strip(".ico") if ".ICO" in ictf.upper() else None
251
+ self.screenlist.append(Screen(screen,script,release,icon,False))
252
+
253
+ return 1
254
+ else:
255
+ print(f"Information for {screen} already in project.")
256
+ return 1
257
+
258
+ def hasScreen(self,screen:str) -> bool:
259
+ """Checks if the project has the correct screen
260
+ """
261
+ for i in self.screenlist:
262
+ if i.name == screen:
263
+ return True
264
+ return False
265
+
266
+ def getScreen(self,screen:str) -> Screen:
267
+ """Returns a screen object by its name
268
+ """
269
+ for i in self.screenlist:
270
+ if i.name == screen:
271
+ return i
272
+ return None
273
+
274
+ def verScreen(self,screen:str) -> Screen:
275
+ """Verifies a screen exists and returns it
276
+
277
+ Returns:
278
+ screen (Screen): Verified screen
279
+ """
280
+ if not self.hasScreen(screen):
281
+ self.newScreen(screen)
282
+ scr = self.getScreen(screen)
283
+ return scr
284
+
@@ -1,5 +1,5 @@
1
1
  import sys
2
- from project import *
2
+ from VIS.project import *
3
3
  import subprocess
4
4
  import json
5
5
  import shutil
@@ -26,7 +26,7 @@ def build(version:str=""):
26
26
  name_list = []
27
27
 
28
28
  for i in info[name]["Screens"].keys():
29
- if info[name]["Screens"][i]["release"] == "TRUE":
29
+ if info[name]["Screens"][i]["release"]:
30
30
  name_list.append(i)
31
31
  file = info[name]["Screens"][i]["script"]
32
32
  #icon = "du"
@@ -59,7 +59,7 @@ def clean(version:str=" "):
59
59
  """Cleans up build environment to save space
60
60
  """
61
61
  print("Cleaning up build environment")
62
- if version == "":
62
+ if version == " ":
63
63
  if exists(f"{root}/dist/{name}/Icons/"): shutil.rmtree(f"{root}/dist/{name}/Icons/")
64
64
  if exists(f"{root}/dist/{name}/Images/"): shutil.rmtree(f"{root}/dist/{name}/Images/")
65
65
  shutil.copytree(root+"/Icons/",f"{root}/dist/{name}/Icons/",dirs_exist_ok=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: VIStk
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: Visual Interfacing Structure for python using tkinter
5
5
  Author-email: Elijah Love <elijah2005l@gmail.com>
6
6
  Maintainer-email: Elijah Love <elijah2005l@gmail.com>
@@ -16,13 +16,9 @@ Form/modules/__init__.py
16
16
  VIS/Form.zip
17
17
  VIS/VIS.py
18
18
  VIS/__init__.py
19
- VIS/elements.py
20
19
  VIS/menu.py
21
- VIS/patch.py
22
20
  VIS/project.py
23
21
  VIS/release.py
24
- VIS/screen.py
25
- VIS/stitch.py
26
22
  VIS/Templates/collect.txt
27
23
  VIS/Templates/f_element.txt
28
24
  VIS/Templates/screen.txt
@@ -26,6 +26,12 @@
26
26
 
27
27
  - Added ```VIS remove sync``` to sync alpha beta and current
28
28
 
29
+ 0.3.7
30
+
31
+ - VIS now uses mostly project.py to manage everything
32
+ - - this is much sleaker and faster
33
+ - - aiming to remove the need to use any subprocess.call
34
+
29
35
  ## Upcoming
30
36
 
31
37
  ### Pre Official Release
@@ -0,0 +1,30 @@
1
+ # Issues
2
+
3
+ ## Unresolved
4
+
5
+ ### Project Setup
6
+
7
+ #### Hangs on VIS new
8
+
9
+ Found 0.3.6
10
+
11
+ Known work-arounds:
12
+
13
+ - Ctrl+C and continue process
14
+
15
+ ## Resolved
16
+
17
+ ### Form/Template
18
+
19
+ #### Relative path breaks after .exe is created
20
+
21
+ Found 0.3.3
22
+ Fixed 0.3.6
23
+
24
+ ### Project Setup
25
+
26
+ #### Form Extracts Wrong
27
+
28
+ Found 0.3.6
29
+ Fixed 0.3.7
30
+
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "VIStk"
7
- version = "0.3.6"
7
+ version = "0.3.7"
8
8
  license = {file="LICENSE"}
9
9
  dependencies = ["tk"]
10
10
  description = "Visual Interfacing Structure for python using tkinter"
vistk-0.3.6/VIS/Form.zip DELETED
Binary file
vistk-0.3.6/VIS/VIS.py DELETED
@@ -1,96 +0,0 @@
1
- import sys
2
- import os
3
- import zipfile
4
- import subprocess
5
- import shutil
6
- import project as vp
7
- from importlib import metadata
8
- import json
9
-
10
- #Need to get current python location where VIS is installed
11
- vl = subprocess.check_output('python -c "import os, sys; print(os.path.dirname(sys.executable))"').decode().strip("\r\n")+"\\Lib\\site-packages\\VIS\\"
12
- #print(vl)
13
-
14
- inp = sys.argv
15
- #print("entered ",inp[1]," as ",inp)
16
- try:
17
- (wd := os.getcwd()) if inp[1] in ["new","New","N","n"] else (wd := vp.getPath())
18
- except:
19
- print(f"VIS Version {metadata.version("VIS")}")
20
- sys.exit()
21
-
22
- #Copied from source
23
- #https://stackoverflow.com/a/75246706
24
- def unzip_without_overwrite(src_path, dst_dir):
25
- with zipfile.ZipFile(src_path, "r") as zf:
26
- for member in zf.infolist():
27
- file_path = os.path.join(dst_dir, member.filename)
28
- if not os.path.exists(file_path):
29
- zf.extract(member, dst_dir)
30
- def __main__():
31
- match inp[1]:
32
- case "new"|"New"|"N"|"n":#Create a new VIS project
33
- if vp.getPath() == None:
34
- os.mkdir(wd+"\\.VIS")
35
- open(wd+"/.VIS/path.cfg","w").write(wd) if os.path.exists(wd+"/.VIS/path.cfg") else open(wd+"/.VIS/path.cfg", 'a').write(wd)
36
- print(f"Created path.cfg as {vp.getPath()}")
37
- unzip_without_overwrite(vl.replace("\\","/")+"Form.zip",wd)#Unzip project template to project
38
- shutil.copytree(vl+"Templates",wd+".VIS/Templates",dirs_exist_ok=True)#copy templates to project
39
- #DO NOT MESS WITH THE TEMPLATE HEADERS
40
- title = input("Enter a name for the VIS project:")
41
- info = {}
42
- info[title] = {}
43
- info[title]["Screens"]={}
44
- info[title]["defaults"]={}
45
- info[title]["defaults"]["icon"]="VIS"#default icon
46
- os.mkdir(wd+"\\.VIS\\project.json")
47
- with open(wd+"/.VIS/project.json","w") as f:
48
- json.dump(info,f,indent=4)
49
- else:
50
- print(f"VIS project already initialized with path {vp.getPath()}")
51
-
52
- case "add" | "Add" | "a" | "A":
53
- match inp[2]:
54
- case "screen" | "Screen" | "s" | "S":
55
- screen = inp[3] #File & directory creation for VIS structure
56
- print("Screens/"+screen+"\t exists") if os.path.exists(wd+"/Screens/"+screen) else os.mkdir(wd+"/Screens/"+screen)
57
- print("modules/"+screen+"\t exists") if os.path.exists(wd+"/modules/"+screen) else os.mkdir(wd+"/modules/"+screen)
58
- print(screen+".py\t\t exists") if os.path.exists(wd+screen+".py") else shutil.copyfile(wd+"/.VIS/Templates/screen.txt",wd+"/"+screen+".py")
59
-
60
- with open(wd+"/.VIS/project.json","r") as f:
61
- info = json.load(f)
62
- name = list(info.keys())[0]
63
- if info[name]["Screens"].get(screen) == None:
64
- sc_name = input("What is the name of this screen?: ")
65
- info[name]["Screens"][sc_name] ={}
66
- info[name]["Screens"][sc_name]["script"] = screen+".py"
67
- match input("Should this screen have its own .exe?: "):
68
- case "Yes" | "yes" | "Y" | "y":
69
- info[name]["Screens"][sc_name]["release"] = "TRUE"
70
- case _:
71
- info[name]["Screens"][sc_name]["release"] = "FALSE"
72
- ictf =input("What is the icon for this screen (or none)?: ")
73
- if ".ICO" in ictf.upper():
74
- info[name]["Screens"][sc_name]["icon"] = ictf.strip(".ico")
75
- with open(wd+"/.VIS/project.json","w") as f:
76
- json.dump(info,f,indent=4)
77
- #somewhere in this process we can attempt to replace "Placeholder Title" and the root.iconbitmap
78
-
79
-
80
- if len(inp) >= 5:
81
- match inp[4]:
82
- case "menu" | "Menu" | "m" | "M":
83
- print("Add screen menu")
84
- case "elements" | "Elements" | "e" | "E":
85
- subprocess.call("python " + vl.replace("\\","/")+"/elements.py "+ screen + " " + inp[5])
86
- else:
87
- print("Add Screen")
88
-
89
- case "patch" | "Patch" | "p" | "P":
90
- subprocess.call("python " + vl.replace("\\","/")+"/patch.py " + inp[2])
91
-
92
- case "stitch" | "Stitch" | "s" | "S":
93
- subprocess.call("python " + vl.replace("\\","/")+"/stitch.py "+ inp[2])
94
-
95
- case "release" | "Release" | "r" | "R":
96
- subprocess.call("python " + vl.replace("\\","/")+"/release.py " + inp[2])
@@ -1,27 +0,0 @@
1
- import sys
2
- import shutil
3
- import os
4
- import subprocess
5
- import project as vp
6
-
7
- screen = sys.argv[1]
8
- elements = sys.argv[2]
9
- elements = elements.split('-')
10
-
11
- project = vp.getPath()
12
-
13
- for e in elements:
14
- if not os.path.exists(project+"/Screens/"+screen+"/f_"+e+".py"):
15
- shutil.copyfile(project+"/.VIS/Templates/f_element.txt",project+"/Screens/"+screen+"/f_"+e+".py")
16
- print("element\tf_"+e+".py\tcreated in\tScreens/"+screen+"/")
17
- subprocess.call("VIS patch "+project+"/Screens/"+screen+"/"+e+".py")
18
-
19
- if not os.path.exists(project+"/modules/"+screen+"/m_"+e+".py"):
20
- with open(project+"/modules/"+screen+"/m_"+e+".py", "w"): pass
21
- print("module\tm_"+e+".py\tcreated in\tScreens/"+screen+"/")
22
-
23
- if not os.path.exists(project+"/"+screen+".py"):#cannot create elements without screen so will create screen if it doesnt exist
24
- shutil.copyfile(project+"/.VIS/Templates/screen.txt"+project+"/"+screen+".py")
25
- print("screen\t"+e+".py \tcreated in\troot")
26
-
27
- subprocess.call("VIS stitch "+screen)
vistk-0.3.6/VIS/patch.py DELETED
@@ -1,11 +0,0 @@
1
- import sys
2
-
3
- file = sys.argv[1]
4
- frame = file.split('/')[-1][:-3]
5
- file=file.replace(frame,"f_"+frame)
6
- with open(file,"r") as f:
7
- text = f.read()
8
- text = text.replace("<frame>","f_"+frame)
9
- with open(file,"w") as f:
10
- f.write(text)
11
- print("patched\tf_"+frame+".py")
@@ -1,16 +0,0 @@
1
- import os
2
- def getPath():
3
- """Searches for .VIS folder and returns from path.cfg
4
- """
5
- sto = 0
6
- while True:
7
- try:
8
- step=""
9
- for i in range(0,sto,1): #iterate on sto to step backwards and search for project info
10
- step = "../" + step
11
- if os.path.exists(step+".VIS/"):
12
- return open(step+".VIS/path.cfg","r").read().replace("\\","/") #return stored path
13
- else:
14
- sto += 1
15
- except:
16
- return None #if failed return none
vistk-0.3.6/VIS/screen.py DELETED
@@ -1,15 +0,0 @@
1
- import sys
2
- file = sys.argv[1]
3
- frame = file.split('\\')[-1][:-3]
4
- dump_screens = False
5
- dump_modules = False
6
- with open(file,"r") as f:
7
- text= f.readlines()
8
- for line in text:
9
- if "screen elements" in line.lower():
10
- dump_screens=True
11
- elif "screen elements" in line.lower():
12
- dump_modules=True
13
-
14
- with open(file,"w") as f:
15
- f.write(text)
vistk-0.3.6/VIS/stitch.py DELETED
@@ -1,37 +0,0 @@
1
- import sys
2
- import re
3
- import glob
4
- import project as vp
5
-
6
- project = vp.getPath()
7
- screen = sys.argv[1]
8
- with open(project+"/"+screen+".py","r") as f:
9
- text = f.read()
10
-
11
- #Elements
12
- pattern = r"#Screen Elements.*#Screen Grid"
13
- replacement = glob.glob(project+"/Screens/"+screen+'/f_*')
14
- for i in range(0,len(replacement),1):
15
- replacement[i] = replacement[i].replace("\\","/")
16
- replacement[i] = replacement[i].replace(project+"/Screens/"+screen+"/","Screens."+screen+".")[:-3]
17
- #print(replacement)
18
- replacement = "from " + " import *\nfrom ".join(replacement) + " import *\n"
19
- #print(replacement)
20
- text = re.sub(pattern, "#Screen Elements\n" + replacement + "\n#Screen Grid", text, flags=re.DOTALL)
21
-
22
- #Modules
23
- pattern = r"#Screen Modules.*#Handle Arguments"
24
- replacement = glob.glob(project+"/modules/"+screen+'/m_*')
25
- for i in range(0,len(replacement),1):
26
- replacement[i] = replacement[i].replace("\\","/")
27
- print("stitching\t"+replacement[i].strip(project)+"\tto\t"+screen+".py")
28
- replacement[i] = replacement[i].replace(project+"/modules/"+screen+"/","modules."+screen+".")[:-3]
29
- #print(replacement)
30
- replacement = "from " + " import *\nfrom ".join(replacement) + " import *\n"
31
- #print(replacement)
32
- text = re.sub(pattern, "#Screen Modules\n" + replacement + "\n#Handle Arguments", text, flags=re.DOTALL)
33
- #print(text)
34
-
35
- with open(project+"/"+screen+".py","w") as f:
36
- f.write(text)
37
- print("stitched\t"+screen+".py\twith\tall")
@@ -1,11 +0,0 @@
1
- # Issues
2
-
3
- ## Form/Template
4
-
5
- ### Relative path breaks after .exe is created
6
-
7
- Found 0.3.3
8
-
9
- Known work-arounds:
10
-
11
- - Copy Icons and Images folder to dist/release/
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