pingwizard 1.0.3__tar.gz → 1.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pingwizard
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: Light-weight interface for running PING ecosystem (PINGMapper, etc.)
5
5
  Author: Cameron Bodine
6
6
  Author-email: bodine.cs@gmail.email
@@ -0,0 +1,128 @@
1
+
2
+ import os, sys
3
+ import platform
4
+ import subprocess
5
+
6
+ PySimpleGUI_License = 'e3yAJ9MVaOWANplCbmndNNl2VwHvlCwpZTSjIl6DIjkiRGpYc53aRty8aBWpJF1qdwGLlzv9bUiHILs3Inkyxpp5Yq2OVku8cg2ZVrJ7RNCQI66bMcTLcnyKMbTRMK57OCTPMGxGNtS8whirTBGTlLjxZEWg5DzWZdUXRUlLcDGfxnv7eiWB1jlOb6nqR8WTZ2XsJVzbabW19ouWI6j0oXiKN0Si4AwtI7iFw8iGTBmtFftjZEUxZMpYcLncNk0rIJj4oyisQq2uFCtqZnXWJvvqbEiCICsSIbkC5jhKbvWTVqM2YtX6Ni0XIJjloji1QEmU9Ak5ayWp5nlnIwi3wiiOQK279ytqcKGwFGuvepS6IH6iIOiYIGs7I4kYNQ13cY33RkvIbqWkVyypSKUOQoiZO2ijIFzaMNTEAp0bNxyWI1sLIwkRRjhZdNGBVoJkcZ3MNN1yZMWTQtihOiieIYyXMDDIIF0ILaTyAt36LKTREj5JI1iYwcixRgGuFk0BZGU5VZ4dciGUl3ykZ3XtMbilOMiBIhy1M5DtId1mL6T1A935LYTLEN5iI3iJwoirR8Wa12h5a0WtxkBNZdGiRJyYZXX9N5zZI2jSoZizYpmp9YkHaIWz5YluLTmcNXzNQmGZd0twYGW6l3sALZmTNWvubcSEItsPITk6lFQgQUWZRrkfcEmAVxz0c9y7IG6sILjZEYyzO8Cf4c0WLDj3QCwSLwjPEt2BMMi0J69p854e39898f71ea82d3a530f7a6ed8a02a4eea9ffd2c7b1279074b491c71b411f392e6d726a2d2f9dbf63388356cf4e083e358fe428852d676073e128607b9ad194c15e34a4feb463a749fd3295606caa293b823d102e854cd845b79b5ec5eaec0b2ef7f9cf0c87b2dfcad3f14cd0d66a2da97e6b38a535eb8707b4486c9802a4bfeb09703382e157449096f0e3551af9f444197cacb3f3d42187cea97ab61978985ddeecd086b9cb86c4ec1c08082d47b3ed0ae9c044d9aa65e5c9bf6e00238f78ed858cfdaf0021fb95d636e0cce84d84d2c2da7ac57f2e54fe793fce44a8b8abf96ce7c381f4b7eeb55dc4b68768e8172a4dffc1b683e62a108b2dfc2ef340dab058e6ee5c1f525f93e89d39258862f099987a8ec7022db5aecb5a58e81d02370d5717d18498ae58749aa5e463cf757ab7fa84efe49c1b770da397eef22423696ad433e7232646e279906bef084b21714ac5fc2af564a03ebc789123aed44531765b3e72c6165131feab68e35e0276a64760ee9abf043bece1e3cd148bcec97ab835395391387ff9d2b74a835a15ea5bac9c7e1218c217481a3999a91e037a138aaf5dddadb2247141242140b130e273aab5e1e6855fae8b7ee80d64be2d09a46f3d49555f53a7a849138fc3b9d2323658ea7e86a0039c40f3c15fd3647f99ec98232d9734a5933177c48c6575a1415e2808640cfb27773e728fe128b99757'
7
+ import PySimpleGUI as sg
8
+
9
+ # Get user's home directory
10
+ home_path = os.path.expanduser('~')
11
+
12
+ def get_shortcut_location(home_p: str):
13
+
14
+ # Set start path
15
+ start_path = os.path.join(home_p, 'Desktop')
16
+
17
+ # Check if start_path valid
18
+ ## 'Desktop' name different based on os language
19
+ if not os.path.exists(start_path):
20
+ start_path = home_p
21
+
22
+ ###################
23
+ # Create simple gui
24
+ title = sg.Text('Save shortcut at this location:')
25
+ path_input = sg.In(default_text=start_path, size=(80, 1))
26
+ path_browse = sg.FolderBrowse(key='shortcut_path', initial_folder=start_path)
27
+
28
+ layout = [
29
+ [title],
30
+ [path_input, path_browse],
31
+ [sg.Submit(), sg.Quit()],
32
+ ]
33
+
34
+ layout2 =[[sg.Column(layout, scrollable=False)]]
35
+ window = sg.Window('Set Shortcut Location', layout2, resizable=True)
36
+
37
+ ##########
38
+ # Open Gui
39
+ while True:
40
+ event, values = window.read()
41
+
42
+ if event == "Quit" or event == "Submit":
43
+ break
44
+
45
+ window.close()
46
+
47
+ if event == "Quit":
48
+ sys.exit()
49
+
50
+ return values['shortcut_path']
51
+
52
+
53
+ def windows_shortcut(conda_base: str, conda_env: str, f: str):
54
+
55
+ to_write = "set conda_base={}\n".format(conda_base)+\
56
+ """set conda_env="{}"\n""".format(conda_env)+\
57
+ "\n"+\
58
+ '''call %conda_base%\\Scripts\\activate %conda_env%\n\n'''+\
59
+ "call conda env list\n\n"+\
60
+ "echo Launching PINGWizard\n"+\
61
+ "python -m pingwizard\n"+\
62
+ "pause"
63
+
64
+ print('\n\n', to_write)
65
+
66
+ with open(f, 'w') as file:
67
+ file.write(to_write)
68
+
69
+ print('\n\nShortcut saved here:', f)
70
+
71
+ return
72
+
73
+ def linux_shortcut(conda_base: str, conda_env: str, f: str):
74
+
75
+ to_write = "#!/bin/bash\n"+\
76
+ """conda_base="{}"\n""".format(conda_base)+\
77
+ """conda_env="{}"\n""".format(conda_env)+\
78
+ "\n"+\
79
+ '''source $conda_base/bin/activate $conda_env\n'''+\
80
+ "\n"+\
81
+ "echo Launching PINGWizard\n"+\
82
+ "python -m pingwizard\n"
83
+
84
+ print('\n\n', to_write)
85
+
86
+ with open(f, 'w') as file:
87
+ file.write(to_write)
88
+
89
+ # Make executable
90
+ subprocess.run('''chmod u+x "{}"'''.format(f), shell=True)
91
+
92
+ # Print instructions
93
+ print('\n\nLaunch PINGWizard from the console by passing')
94
+ print(f)
95
+ print('OR')
96
+ print('./PINGWizard.sh')
97
+ print('after navigating console to {}.\n\n'.format(os.path.dirname(f)))
98
+
99
+ pass
100
+
101
+ def create_shortcut():
102
+
103
+ # Get ping Environment Path
104
+ conda_env = os.environ['CONDA_PREFIX']
105
+
106
+ # Get Conda base path from ping environment path
107
+ conda_base = conda_env.split('envs')[0]
108
+
109
+ # Reset conda_env
110
+ conda_env = 'ping'
111
+
112
+ # Get shorcut location
113
+ file_path = get_shortcut_location(home_path)
114
+
115
+ # Make the file
116
+ if "Windows" in platform.system():
117
+ # Set file_path
118
+ file_path = os.path.join(file_path, "PINGWizard.bat")
119
+ windows_shortcut(conda_base=conda_base, conda_env=conda_env, f=file_path)
120
+
121
+ else:
122
+ # Set file_path
123
+ file_path = os.path.join(file_path, "PINGWizard.sh")
124
+ linux_shortcut(conda_base=conda_base, conda_env=conda_env, f=file_path)
125
+
126
+
127
+ if __name__ == "__main__":
128
+ create_shortcut()
@@ -0,0 +1 @@
1
+ __version__ = '1.0.5'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pingwizard
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: Light-weight interface for running PING ecosystem (PINGMapper, etc.)
5
5
  Author: Cameron Bodine
6
6
  Author-email: bodine.cs@gmail.email
@@ -1,79 +0,0 @@
1
-
2
- import os, sys
3
- import platform
4
- import subprocess
5
-
6
- # Get user's home directory
7
- home_path = os.path.expanduser('~')
8
-
9
- def windows_shortcut(conda_base: str, conda_env: str, f: str):
10
-
11
- to_write = "set conda_base={}\n".format(conda_base)+\
12
- """set conda_env="{}"\n""".format(conda_env)+\
13
- "\n"+\
14
- '''call %conda_base%\\Scripts\\activate %conda_env%\n\n'''+\
15
- "call conda env list\n\n"+\
16
- "echo Launching PINGWizard\n"+\
17
- "python -m pingwizard\n"+\
18
- "pause"
19
-
20
- print('\n\n', to_write)
21
-
22
- with open(f, 'w') as f:
23
- f.write(to_write)
24
-
25
- return
26
-
27
- def linux_shortcut(conda_base: str, conda_env: str, f: str):
28
-
29
- to_write = "#!/bin/bash\n"+\
30
- """conda_base="{}"\n""".format(conda_base)+\
31
- """conda_env="{}"\n""".format(conda_env)+\
32
- "\n"+\
33
- '''source $conda_base/bin/activate $conda_env\n'''+\
34
- "\n"+\
35
- "echo Launching PINGWizard\n"+\
36
- "python -m pingwizard\n"
37
-
38
- print('\n\n', to_write)
39
-
40
- with open(f, 'w') as file:
41
- file.write(to_write)
42
-
43
- # Make executable
44
- subprocess.run('''chmod u+x "{}"'''.format(f), shell=True)
45
-
46
- # Print instructions
47
- print('\n\nLaunch PINGWizard from the console by passing')
48
- print(f)
49
- print('OR')
50
- print('./PINGWizard.sh')
51
- print('after navigating console to Desktop.\n\n')
52
-
53
- pass
54
-
55
- def create_shortcut():
56
-
57
- # Get ping Environment Path
58
- conda_env = os.environ['CONDA_PREFIX']
59
-
60
- # Get Conda base path from ping environment path
61
- conda_base = conda_env.split('envs')[0]
62
-
63
- # Reset conda_env
64
- conda_env = 'ping'
65
-
66
- # Make the file
67
- if "Windows" in platform.system():
68
- # Set file_path
69
- file_path = os.path.join(home_path, "PINGWizard.bat")
70
- windows_shortcut(conda_base=conda_base, conda_env=conda_env, f=file_path)
71
-
72
- else:
73
- # Set file_path
74
- file_path = os.path.join(home_path, "PINGWizard.sh")
75
- linux_shortcut(conda_base=conda_base, conda_env=conda_env, f=file_path)
76
-
77
-
78
- if __name__ == "__main__":
79
- create_shortcut()
@@ -1 +0,0 @@
1
- __version__ = '1.0.3'
File without changes
File without changes
File without changes
File without changes