Skip to content

Commit

Permalink
Merge pull request #209 from TrevisanGMW/dev.bugfix/import_issues
Browse files Browse the repository at this point in the history
Dev.bugfix/import issues
  • Loading branch information
TrevisanGMW authored Dec 12, 2024
2 parents 1954af8 + 3f13841 commit 6f14f68
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 61 deletions.
2 changes: 1 addition & 1 deletion gt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

# Package Variables
__version_tuple__ = (3, 4, 0)
__version_tuple__ = (3, 4, 1)
__version_suffix__ = ""
__version__ = ".".join(str(n) for n in __version_tuple__) + __version_suffix__
__authors__ = ["Guilherme Trevisan"]
Expand Down
15 changes: 9 additions & 6 deletions gt/core/str.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,18 @@ def replace_keys_with_values(input_string, replacements_dict, case_sensitive=Tru
# Create a case-insensitive version of the replacements dictionary
replacements_dict = {key.lower(): value for key, value in replacements_dict.items()}
lower_input_string = input_string.lower()
output_string = input_string

for key, value in replacements_dict.items():
if key in lower_input_string:
# This replacement needs to handle multiple occurrences
start = 0
while (start := lower_input_string.find(key, start)) != -1:
start = 0
while start != -1:
start = lower_input_string.find(key, start)
if start != -1:
end = start + len(key)
input_string = input_string[:start] + value + input_string[end:]
output_string = output_string[:start] + value + output_string[end:]
lower_input_string = lower_input_string[:start] + value.lower() + lower_input_string[end:]
start = end
start += len(value)
return output_string
else:
for key, value in replacements_dict.items():
input_string = input_string.replace(key, value)
Expand Down
4 changes: 2 additions & 2 deletions gt/tools/package_updater/package_updater_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ def print_extract_progress(current_file, total_files):
sys.path.insert(0, extracted_module_path)

# Import and run installer -----------------------------------------------
import gt.core.setup as setup_utils
import gt.core.setup as core_setup

is_installed = False
try:
is_installed = setup_utils.install_package(
is_installed = core_setup.install_package(
callbacks=[self.progress_win.add_text_to_output_box, self.progress_win.increase_progress_bar_value]
)
except Exception as e:
Expand Down
4 changes: 0 additions & 4 deletions gt/ui/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,6 @@ def close_parent_window(self):
window.first_button.clicked.connect(window.close_window)

window.set_progress_bar_max_value(8)
# window.set_progress_bar_done()
# import core.setup_utils as setup_utils
# setup_utils.install_package(passthrough_functions=[window.append_text_to_output_box,
# window.increase_progress_bar_value])

index = 0
import time
Expand Down
Loading

0 comments on commit 6f14f68

Please sign in to comment.