Skip to content

Commit

Permalink
assistant: basic voice control GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
knuxify committed Feb 28, 2022
1 parent 26df068 commit 11af560
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 95 deletions.
1 change: 1 addition & 0 deletions data/lapel.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<file>ui/about.ui</file>
<file>ui/assistant.ui</file>
<file>ui/messageview.ui</file>
<file>ui/speechview.ui</file>
<file>ui/window.ui</file>
</gresource>
</gresources>
10 changes: 10 additions & 0 deletions data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@
font-size: 1.1em;
padding: 6px;
}

.speech-view {
border-top: 1px solid @borders;
background-color: @headerbar_bg_color;
color: @headerbar_fg_color;
}

.speech-view-container {
padding: 12px;
}
210 changes: 115 additions & 95 deletions data/ui/assistant.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,134 +6,154 @@
<property name="orientation">vertical</property>

<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkRevealer" id="no_connection">
<property name="reveal-child">false</property>
<property name="transition-type">crossfade</property>

<style>
<class name="no-connection-overlay"/>
</style>

<child>
<object class="AdwStatusPage" id="no_connection_status">
<property name="icon-name">network-error-symbolic</property>
<property name="title" translatable="yes">Could Not Connect</property>
<property name="description" translatable="yes">Failed to connect to Mycroft websocket. Make sure that Mycroft is running.</property>

<style>
<class name="no-connection-status"/>
</style>
</object>
</child>
</object>
</child>

<child type="overlay">
<object class="GtkButton" id="scroll_down_button">
<property name="visible">false</property>
<property name="icon-name">go-bottom-symbolic</property>
<property name="halign">end</property>
<property name="valign">end</property>

<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>

<signal name="clicked" handler="scroll_to_bottom"/>

<style>
<class name="osd"/>
<class name="circular"/>
<class name="suggested-action"/>
</style>
</object>
</child>
<object class="AdwFlap" id="content_flap">
<property name="vexpand">true</property>
<property name="orientation">vertical</property>
<property name="fold-policy">always</property>
<property name="flap-position">end</property>
<property name="reveal-flap">false</property>

<child>
<object class="GtkScrolledWindow">
<property name="vexpand">true</property>
<property name="vadjustment">vadjustment</property>

<style>
<class name="background"/>
</style>
<object class="GtkBox">
<property name="orientation">vertical</property>

<child>
<object class="GtkViewport">
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkRevealer" id="no_connection">
<property name="reveal-child">false</property>
<property name="transition-type">crossfade</property>

<child>
<object class="AdwClamp">
<child>
<object class="GtkListBox" id="message_list">
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<property name="valign">end</property>
<style>
<class name="no-connection-overlay"/>
</style>

<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>
<child>
<object class="AdwStatusPage" id="no_connection_status">
<property name="icon-name">network-error-symbolic</property>
<property name="title" translatable="yes">Could Not Connect</property>
<property name="description" translatable="yes">Failed to connect to Mycroft websocket. Make sure that Mycroft is running.</property>

<style>
<class name="background"/>
<class name="no-connection-status"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>

<child>
<object class="GtkBox">
<style>
<class name="toolbar"/>
<class name="input-container"/>
</style>
<child type="overlay">
<object class="GtkButton" id="scroll_down_button">
<property name="visible">false</property>
<property name="icon-name">go-bottom-symbolic</property>
<property name="halign">end</property>
<property name="valign">end</property>

<child>
<object class="AdwClamp">
<property name="hexpand">true</property>
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>

<child>
<object class="GtkBox" id="input_container">
<property name="spacing">5</property>
<signal name="clicked" handler="scroll_to_bottom"/>

<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>
<style>
<class name="osd"/>
<class name="circular"/>
<class name="suggested-action"/>
</style>
</object>
</child>

<child>
<object class="GtkButton" id="voice_recognition_button">
<property name="icon-name">microphone-sensitivity-high-symbolic</property>
<signal name="clicked" handler="start_record"/>
<object class="GtkScrolledWindow">
<property name="vexpand">true</property>
<property name="vadjustment">vadjustment</property>

<style>
<class name="raised"/>
<class name="background"/>
</style>

<child>
<object class="GtkViewport">
<property name="hexpand">true</property>
<property name="vexpand">true</property>

<child>
<object class="AdwClamp">
<child>
<object class="GtkListBox" id="message_list">
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<property name="valign">end</property>

<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>

<style>
<class name="background"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>

<child>
<object class="GtkBox">
<style>
<class name="toolbar"/>
<class name="input-container"/>
</style>

<child>
<object class="GtkEntry" id="input_entry">
<object class="AdwClamp">
<property name="hexpand">true</property>
<signal name="activate" handler="send_message"/>

<child>
<object class="GtkBox" id="input_container">
<property name="spacing">5</property>

<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>

<child>
<object class="GtkButton" id="voice_recognition_button">
<property name="icon-name">microphone-sensitivity-high-symbolic</property>
<signal name="clicked" handler="start_record"/>

<style>
<class name="raised"/>
</style>
</object>
</child>

<child>
<object class="GtkEntry" id="input_entry">
<property name="hexpand">true</property>
<signal name="activate" handler="send_message"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>

<child type="flap">
<object class="SpeechView" id="speech_view"/>
</child>
</object>
</child>
</template>
Expand Down
57 changes: 57 additions & 0 deletions data/ui/speechview.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="SpeechView" parent="GtkBox">
<property name="hexpand">true</property>

<style>
<class name="speech-view"/>
</style>

<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkButton">
<property name="icon-name">window-close-symbolic</property>
<property name="halign">end</property>
<property name="valign">start</property>

<signal name="clicked" handler="close"/>
</object>
</child>

<child>
<object class="GtkBox" id="info_container">
<property name="orientation">vertical</property>
<property name="hexpand">true</property>
<property name="spacing">32</property>
<property name="margin-top">48</property>
<property name="margin-bottom">48</property>

<style>
<class name="speech-view-container"/>
</style>

<child>
<object class="GtkImage">
<property name="icon-name">microphone-sensitivity-high-symbolic</property>
<property name="icon-size">large</property>
<property name="hexpand">true</property>
</object>
</child>

<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Speak to the microphone</property>
<property name="wrap">true</property>
<style>
<class name="title-2"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>

0 comments on commit 11af560

Please sign in to comment.