pingwizard 1.0.25__tar.gz → 1.0.26__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.4
2
2
  Name: pingwizard
3
- Version: 1.0.25
3
+ Version: 1.0.26
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,7 +1,7 @@
1
1
 
2
2
  import sys, os
3
3
  import time
4
- import runpy
4
+ import subprocess
5
5
  from pingwizard.version import __version__ as pwversion
6
6
  from pingwizard.check_available_updates import check
7
7
 
@@ -30,9 +30,6 @@ def wizard():
30
30
  if 'PINGINSTALLER_VERBOSITY' not in os.environ:
31
31
  os.environ['PINGINSTALLER_VERBOSITY'] = 'debug'
32
32
 
33
- # Save the original sys.argv
34
- original_argv = sys.argv
35
-
36
33
  ##########################
37
34
  # Define the layout blocks
38
35
 
@@ -89,15 +86,73 @@ def wizard():
89
86
 
90
87
  layout2 =[[sg.Column(layout, scrollable=True, vertical_scroll_only=True, size_subsample_height=1)]]
91
88
  window = sg.Window('PING Wizard', layout2, resizable=True)
89
+ pre_minimize_state = {'state': 'normal'}
90
+
91
+ def _minimize_wizard(win):
92
+ # Force a repaint before blocking on subprocess so minimize is visible.
93
+ try:
94
+ win.refresh()
95
+ except Exception:
96
+ pass
97
+
98
+ try:
99
+ pre_minimize_state['state'] = win.TKroot.state()
100
+ except Exception:
101
+ pre_minimize_state['state'] = 'normal'
102
+
103
+ try:
104
+ win.minimize()
105
+ except Exception:
106
+ try:
107
+ win.TKroot.iconify()
108
+ except Exception:
109
+ win.Disappear()
110
+
111
+ # Give the window manager a moment to process minimize events.
112
+ time.sleep(0.1)
113
+
114
+ def _restore_wizard(win):
115
+ restored = False
116
+ try:
117
+ win.TKroot.deiconify()
118
+ win.Reappear()
119
+ win.TKroot.lift()
120
+ win.TKroot.focus_force()
121
+ restored = True
122
+ except Exception:
123
+ pass
124
+
125
+ if not restored:
126
+ try:
127
+ win.normal()
128
+ restored = True
129
+ except Exception:
130
+ pass
131
+
132
+ if not restored:
133
+ try:
134
+ win.Reappear()
135
+ except Exception:
136
+ pass
137
+
138
+ try:
139
+ win.refresh()
140
+ except Exception:
141
+ pass
92
142
 
93
143
 
94
144
  #################
95
145
  # Open the wizard
96
146
  while True:
97
- event, values = window.read()
147
+ read_result = window.read()
148
+ if read_result is None:
149
+ break
150
+ event, values = read_result
98
151
  if event == "exit_pingwizard" or event == "Submit":
99
152
  break
100
-
153
+
154
+ module_name = None
155
+ module_args = []
101
156
 
102
157
  # Launch PINGMapper GUI
103
158
  if event == "launch_pingmapper_gui":
@@ -131,7 +186,6 @@ def wizard():
131
186
  print("A new window will open to run the installer from base.")
132
187
  print("The wizard will close to release environment locks.")
133
188
 
134
- import subprocess
135
189
  import tempfile
136
190
 
137
191
  conda_base = os.environ.get('CONDA_PREFIX', '').split('envs')[0].rstrip(os.sep)
@@ -177,17 +231,20 @@ pause
177
231
  module_name = "pinginstaller"
178
232
  module_args = ["check"]
179
233
 
180
- window.Disappear()
181
- sys.argv = [module_name, *module_args]
182
-
183
- # Ensure environment is properly set for installer (mamba/conda detection)
184
- # The installer relies on CONDA_PREFIX to find mamba
185
- if 'CONDA_PREFIX' not in os.environ:
186
- os.environ['CONDA_PREFIX'] = os.environ.get('CONDA_DEFAULT_ENV', '')
187
-
188
- runpy.run_module(module_name, run_name="__main__")
189
- time.sleep(1)
190
- window.Reappear()
234
+ # Ignore non-launch events so the wizard does not re-minimize/relaunch unexpectedly.
235
+ if module_name is None:
236
+ continue
237
+
238
+ _minimize_wizard(window)
239
+ try:
240
+ # Run the selected module in a child process to avoid GUI state conflicts.
241
+ cmd = [sys.executable, '-m', module_name, *module_args]
242
+ result = subprocess.run(cmd, env=os.environ.copy())
243
+ if result.returncode != 0:
244
+ print(f"Warning: {module_name} exited with code {result.returncode}")
245
+ finally:
246
+ time.sleep(1)
247
+ _restore_wizard(window)
191
248
 
192
249
  # window.close()
193
250
 
@@ -0,0 +1 @@
1
+ __version__ = '1.0.26'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pingwizard
3
- Version: 1.0.25
3
+ Version: 1.0.26
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 +0,0 @@
1
- __version__ = '1.0.25'
File without changes
File without changes
File without changes
File without changes