Skip to content

Commit

Permalink
#165 优化安装器日志显示
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Sep 8, 2024
1 parent cf0fbb3 commit 7af523d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/one_dragon/envs/python_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ def is_virtual_python(self) -> bool:
是否虚拟环境的python
:return:
"""
env = os.environ
return 'VIRTUAL_ENV' in env or 'CONDA_PREFIX' in env
is_virtual_str = cmd_utils.run_command([self.env_config.python_path, "-c", "import sys; print(getattr(sys, 'base_prefix', sys.prefix) != sys.prefix)"])
if is_virtual_str is None:
return False
else:
return is_virtual_str == 'True'

def install_default_pip(self, progress_callback: Optional[Callable[[float, str], None]] = None) -> bool:
"""
Expand Down
5 changes: 2 additions & 3 deletions src/one_dragon/gui/view/install_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ def get_content_widget(self) -> QWidget:
update_group.addSettingCard(self.venv_opt)

v_layout.addWidget(update_group)

log_group = SettingCardGroup(gt('安装日志', 'ui'))
self.log_card = LogDisplayCard()
log_group.addSettingCard(self.log_card)
v_layout.addWidget(log_group)
self.log_card = LogDisplayCard()
v_layout.addWidget(self.log_card, stretch=1)

return content_widget

Expand Down
1 change: 1 addition & 0 deletions src/one_dragon/utils/cmd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def run_command(commands: List[str], cwd: Optional[str] = None,
else:
return None
except Exception:
log.error("执行命令失败", exc_info=True)
return None


Expand Down

0 comments on commit 7af523d

Please sign in to comment.