Skip to content

Commit

Permalink
refactor: drop custom QML
Browse files Browse the repository at this point in the history
use the text template from ovos-gui, moving towards a non QT5 GUI

remove unnecessary function implementation, use shutil.which directly

add some TODO comments
  • Loading branch information
JarbasAl committed Dec 26, 2024
1 parent 30028dd commit 7e73bbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 53 deletions.
25 changes: 4 additions & 21 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
from shutil import which
from subprocess import check_output, CalledProcessError

from ifaddr import get_adapters
Expand Down Expand Up @@ -42,28 +42,11 @@ def get_ifaces(ignore_list=None):
return res


def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)

fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file

return False


class IPSkill(OVOSSkill):

def initialize(self):
# Only register the SSID intent if iwlist is installed on the system
if which("iwlist"):
if which("iwlist"): # TODO - use bus events to get this info, not iwlist
self.register_intent_file("what.ssid.intent",
self.handle_SSID_query)

Expand Down Expand Up @@ -102,6 +85,7 @@ def handle_SSID_query(self, message):
self.speak_dialog("no network connection")
return

# TODO - use bus api for PHAL network manager that reports this instead
try:
scanoutput = check_output(["iwlist", "wlan0", "scan"])

Expand Down Expand Up @@ -149,8 +133,7 @@ def handle_query_last_part_IP(self, message):
self.enclosure.mouth_reset()

def gui_show(self, ip):
self.gui['ip'] = ip
self.gui.show_page("ip-address")
self.gui.show_text(ip)
self.enclosure.mouth_text(ip)

def speak_last_digits(self, ip):
Expand Down
32 changes: 0 additions & 32 deletions gui/qt5/ip-address.qml

This file was deleted.

0 comments on commit 7e73bbe

Please sign in to comment.