Skip to content

Commit

Permalink
Fix interactive mode on Windows OS
Browse files Browse the repository at this point in the history
Update requirements.txt
  • Loading branch information
dormant-user committed Mar 23, 2023
1 parent 3ed0303 commit e24e446
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 32 deletions.
4 changes: 0 additions & 4 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ <h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.parse_microphone_index">parse_microphone_index() (jarvis_ui.modules.models.EnvConfig class method)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.Settings.pid">pid (jarvis_ui.modules.models.Settings attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.playsound.PlayAudio.play">play() (jarvis_ui.modules.playsound.PlayAudio method)</a>
</li>
Expand Down Expand Up @@ -369,8 +367,6 @@ <h2 id="R">R</h2>
<li><a href="index.html#jarvis_ui.modules.models.RestartTimer">RestartTimer (class in jarvis_ui.modules.models)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.playsound.PlayAudio.run">run() (jarvis_ui.modules.playsound.PlayAudio method)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.Settings.runenv">runenv (jarvis_ui.modules.models.Settings attribute)</a>
</li>
</ul></td>
</tr></table>
Expand Down
10 changes: 0 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -430,16 +430,6 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading"
<span class="sig-name descname"><span class="pre">operating_system</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#jarvis_ui.modules.models.Settings.operating_system" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="jarvis_ui.modules.models.Settings.pid">
<span class="sig-name descname"><span class="pre">pid</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">PositiveInt</span></em><a class="headerlink" href="#jarvis_ui.modules.models.Settings.pid" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="jarvis_ui.modules.models.Settings.runenv">
<span class="sig-name descname"><span class="pre">runenv</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#jarvis_ui.modules.models.Settings.runenv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="jarvis_ui.modules.models.Settings.wake_words">
<span class="sig-name descname"><span class="pre">wake_words</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#jarvis_ui.modules.models.Settings.wake_words" title="Permalink to this definition"></a></dt>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jarvis_ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pynotification import pynotifier

version = "0.5.3"
version = "0.5.4"

try:
import pvporcupine # noqa
Expand Down
6 changes: 3 additions & 3 deletions jarvis_ui/executables/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def time_converter(second: float) -> str:

def flush_screen() -> NoReturn:
"""Flushes the screen output."""
if models.settings.ide:
sys.stdout.write("\r")
else:
if models.settings.interactive:
sys.stdout.write(f"\r{' '.join(['' for _ in range(os.get_terminal_size().columns)])}")
else:
sys.stdout.write("\r")
5 changes: 2 additions & 3 deletions jarvis_ui/lib/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ SpeechRecognition==3.8.1 # Do not upgrade, no functional upgrade in latest vers
pyttsx3==2.90
inflect==6.0.2
requests>=2.28.2
pydantic[dotenv,email]==1.10.6
pydantic[dotenv,email]==1.10.7
PyYAML
pynotification
psutil==5.9.4
pynotification
14 changes: 4 additions & 10 deletions jarvis_ui/modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import os
import platform
import string
import sys
from collections import ChainMap
from datetime import datetime
from enum import Enum
from multiprocessing import current_process
from typing import List, Optional, Union

import psutil
import pyttsx3
from packaging.version import parse as parser
from pydantic import (BaseSettings, Field, FilePath, HttpUrl, PositiveFloat,
Expand Down Expand Up @@ -64,15 +63,10 @@ class Settings(BaseSettings):
legacy: bool = True if os == "Darwin" and parser(platform.mac_ver()[0]) < parser('10.14') else False
bot: str = "jarvis"
wake_words: Optional[List[str]]
if current_process().name == 'MainProcess':
pid: PositiveInt = os.getpid()
if sys.stdin.isatty():
interactive = True
else:
pid: PositiveInt = os.getppid()
runenv: str = psutil.Process(pid).parent().name()
if runenv.endswith('sh'):
ide = False
else:
ide = True
interactive = False


settings = Settings()
Expand Down
5 changes: 5 additions & 0 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes
=============

0.5.4 (03/22/2023)
------------------
- Fix interactive mode on Windows OS
- Update requirements.txt

0.5.3 (03/22/2023)
------------------
- Fix static IDE identifier on child processes
Expand Down

0 comments on commit e24e446

Please sign in to comment.