|
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
15 | 15 | import builtins |
| 16 | +import os |
16 | 17 | import re |
17 | 18 | import subprocess |
18 | 19 | import sys |
| 20 | +import tempfile |
19 | 21 | # Configure wx uversion to allow running test app in __main__ |
20 | 22 |
|
21 | 23 |
|
|
27 | 29 | import requests |
28 | 30 | import wx |
29 | 31 | from wx import Colour |
| 32 | +from os import path |
30 | 33 |
|
31 | 34 | from .. import version |
32 | 35 | from ..utils.versioncomparator import cmp_versions, parse_version |
@@ -116,7 +119,19 @@ def upgrade_from_dev_dialog(version_installed, notebook, show_no_update=False): |
116 | 119 | f"{SPC}\n", wx.GetActiveWindow(), no_default=True): |
117 | 120 | return False |
118 | 121 | else: |
| 122 | + import zipfile |
| 123 | + backup_configobj = tempfile.NamedTemporaryFile(delete=False) |
| 124 | + config_obj_dir = path.join(path.dirname(__file__), '../preferences/configobj') |
| 125 | + files = os.listdir(config_obj_dir) |
| 126 | + with zipfile.ZipFile(backup_configobj.name, 'w') as zzip: |
| 127 | + for file in files: |
| 128 | + file_path = os.path.join(config_obj_dir, file) |
| 129 | + zzip.write(file_path) |
119 | 130 | do_upgrade(command, notebook) |
| 131 | + with zipfile.ZipFile(backup_configobj.name, 'r') as zzip: |
| 132 | + zzip.extractall(config_obj_dir) |
| 133 | + print(f"DEBUG: updatentivier, {config_obj_dir=} {backup_configobj.name}") |
| 134 | + os.remove(backup_configobj.name) |
120 | 135 | return True |
121 | 136 | else: |
122 | 137 | if show_no_update: |
@@ -174,7 +189,7 @@ def do_upgrade(command, notebook): |
174 | 189 | def start_upgraded(message): |
175 | 190 | __ = message |
176 | 191 | command = sys.executable + " -m robotide.__init__ --noupdatecheck" |
177 | | - wx.CallLater(500, subprocess.Popen, command.split(' '), start_new_session=True) |
| 192 | + wx.CallLater(1000, subprocess.Popen, command.split(' '), start_new_session=True) |
178 | 193 | p = psutil.Process() |
179 | 194 | result = _askyesno(_("Completed Upgrade"), f"\n{SPC}{_('You should close this RIDE (Process ID = ')}{p.pid}){SPC}" |
180 | 195 | f"\n{SPC}{_('Do you want to CLOSE RIDE now?')}\n{SPC}", |
|
0 commit comments