Creating GUI for configuring SUSI Linux Settings

SUSI Linux app provides access to SUSI on Linux distributions on desktop as well as hardware devices like Raspberry Pi. The settings for SUSI Linux are controlled with the use of a config.json file. You may edit the file manually, but to provide safe configurations, we have a config generator script. You may run the script to configure settings like TTS Engine, STT Engine, authentication, choice about the hotword engine etc. Generally, it is easier to configure application settings through a GUI. Thus, we added a GUI for it using PyGTK and Glade. Glade is a GUI designer for GNOME based Linux systems. I wrote a blog about how to create user interfaces in Glade and access it from Python code in SUSI Linux. Now, for creating UI for Configuration screen, we need to choose an ideal layout. Glade provides various choices like BoxLayout, GridLayout, FlowBox, ListBox , Notebook etc. Since, we need to display only basic settings options, we select the BoxLayout for this purpose. BoxLayout as the name suggests, forms a box like arrangement for widgets. You can arrange the widgets in either Landscape or Horizontal Layout. We select Application Window as a top-level container and add a BoxLayout container in it. Now, in each box of the BoxLayout, we need to add the widgets like ComboBox and Switch for user’s choice and a Label. This can be done by using a horizontal BoxLayout with corresponding widgets. After arranging the UI in above described manner, we have a GUI like below. If you see the current window in the preview now, you will find that the ComboBox do not have any items. We need to define items in the ComboBox using a GTKListStore. You may refer to this video tutorial to see how this can be done. Now, when we see the preview, our GUI is fully functional. We have options for Speech Recognition Service, Text to Speech Service in ComboBox. Other simple settings are available as switches. Now, we need to add functionality to our UI. We want our code to be modular and structured, therefore, we declare a ConfigurationWindow class. Though the ideal way to handle such cases is inheriting from the Gtk.Window class, but reading the documentation of PyGTK+ 3, I could not find a way to do this for windows created through Glade. Thus, we will use composition for storing the window object. We add window and other widgets present in the UI as properties of ConfigurationWindow class like this. class ConfigurationWindow: def __init__(self) -> None: super().__init__() builder = Gtk.Builder() builder.add_from_file(os.path.join("glade_files/configure.glade")) self.window = builder.get_object("configuration_window") self.stt_combobox = builder.get_object("stt_combobox") self.tts_combobox = builder.get_object("tts_combobox") self.auth_switch = builder.get_object("auth_switch") self.snowboy_switch = builder.get_object("snowboy_switch") self.wake_button_switch = builder.get_object("wake_button_switch") Now, we need to connect the Signals from our configuration window to the Handler. We declare the Handler as a nested class in the ConfigurationWindow class because its scope of usage is inside the ConfigurationWindow object. Then you may connect signals to an object of the Handler class. builder.connect_signals(ConfigurationWindow.Handler(self)) Since we may need to modify…

Continue ReadingCreating GUI for configuring SUSI Linux Settings

Migration of LXDE Desktop of Meilix to LXQt

Meilix is originally based on LXDE and our task is to migrate Meilix desktop to LXQt. Originally LXQt is a fusion of LXDE and the Razor-Qt desktop. What is LXDE and LXQt ? Both are desktop environment. They are light weight with a beautiful GUI and a user-friendly touch. Older code to install a LXDE desktop in a Debian-based environment is (source): apt-get -q -y --purge install --no-install-recommends \ lxsession lightdm lightdm-gtk-greeter lxterminal gvfs-backends seahorse \ network-manager-gnome xorg dbus-x11 openbox ubiquity-frontend-gtk vlc \ xfce4-mixer gstreamer0.10-alsa pulseaudio pavucontrol lxpanel \ mozilla-plugin-vlc lubuntu-core jockey-gtk In the chroot environment, the maintainer has pick up the it’s dependencies and recommend packages and listed all packages which required to install a LXDE desktop. He keeps the size as small as possible. The maintainer had hand-picked only the required packages which can run the desktop. What we did: We tried with several approaches. Few worked and few did not. We removed all the packages related to desktop like gnome-games, gdm and gnome-language-en since we don’t want any sort of problem conflicts in the new desktop. We had also remove all the lines mentioned above which install LXDE. Then I simply typed the line: apt-get -q -y install lxqt This way we only reach to the CLI version of the OS, and we actually don’t know whether we actually have the desktop install or not. We tried to install lighdm their by sudo apt-get install xinit but that was also giving errors. We changes the line to: apt-get -q -y install xorg sddm lxqt And suddenly the same approach which brought to a black screen and that was a desktop and the window manager was openbox. Then we tried to add sddm.conf to get the desktop and realized that sddm starts plasma instead of LXQt. Then we added a config file for sddm to start up LXQt by default. This file is present in the location `/etc/sddm.conf` in the meilix-default-settings metapackage with the code as: [Autologin] User=hotelos Session=lxqt.desktop But due to a bug reported here, it still starts plasma instead of LXQt. So now I have to patch a script in the location /usr/share/initramfs-tools/scripts/casper-bottom/15autologin In last paragraph of the script it will first detect the presence of sddm, if that exists, it will assume that plasma will be default desktop and try to detect Lubuntu.desktop and QLubuntu.desktop . So, change plasma.desktop to lxqt.desktop. In the 15autologin changes line 84: if [ -f /root/usr/bin/sddm ]; then sddm_session=lxqt.desktop if [ -f /root/usr/share/xsessions/Lubuntu.desktop ]; then sddm_session=Lubuntu.desktop fi if [ -f /root/usr/share/xsessions/QLubuntu.desktop ]; then sddm_session=QLubuntu.desktop fi fi Here, sddm is made to configure it must use lxqt desktop. And this worked. Finally we get the LXQt desktop for Meilix. Since this script along with other scripts will be packed into a small filesystem called initramfs, therefore we have to write `update-initramfs -u ` after the installation of the meilix-default-settings package. I had made a table of the things that worked and that didn't. Things which do not work Things which work…

Continue ReadingMigration of LXDE Desktop of Meilix to LXQt

Making GUI for SUSI Linux with PyGTK

SUSI Linux app provides access to SUSI on Linux distributions on desktop as well as hardware devices like Raspberry Pi. It started off as a headless client but we decided to add a minimalist GUI to SUSI Linux for performing login and configuring settings. Since, SUSI Linux is a Python App, it was desirable to use a GUI Framework compatible with Python. Many popular GUI frameworks now provide bindings for Python. Some popular available choices are: wxPython: wxPython is a Python GUI framework based on wxWidgets, a cross-platform GUI library written in C++. In addition to the standard dialogs, it includes a 2D path drawing API, dockable windows, support for many file formats and both text-editing and word-processing widgets. wxPython though mainly support Python 2 as programming language. PyQT: Qt is a multi-licensed cross-platform framework written in C++. Qt needs a commercial licence for use but if application is completely Open Source, community license can be used. Qt is an excellent choice for GUIs and many applications are based on it. PyGTK / PyGObject: PyGObject is a Python module that lets you write GUI applications in GTK+. It provides bindings to GObject, a cross platform C library. GTK+ applications are natively supported in most distros and you do not need to install any other development tools for developing with PyGTK. Comparing all these frameworks, PyGTK was found to meet our needs very well. To make UIs in PyGTK, you have a WYSIWYG (What you see is what you get) editor called Glade. Though you can design whole UI programmatically, it is always convenient to use an editor like Glade to simplify the creation and styling of widgets. To create a UI, you need to install Glade in your specific distribution. After that open glade, and add a Top Level container Window or AppWindow to your app. Once that is done, you may pick from the available Layout Managers. We are using BoxLayout Manager in SUSI Linux GUIs. Once that is done, add your widgets to the Application Window using Drag and Drop. Properties of widgets are available on the right panel. Edit your widget properties to give them meaningful IDs so we can address them later in our code. GTK also provides Signals for signaling about a events associated with the widgets. Open the Signals tab in the Widget properties pane. Then, you need to write name of the signal handler for the events associated with Widgets. A signal handler is a function that is fired upon the occurrence of the associated event. For example, we have signals like text_changed in Text Entry boxes, and clicked for Button. After completing the design of GUI, we can address the .glade file of the UI we just created in the Python code. We can do this using the following snippet. import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk builder = Gtk.Builder() builder.add_from_file("glade_files/signin.glade") You can reference each widget from the Glade file using its ID like below. email_field = builder.get_object("email_field") Now, to handle all the declared signals in…

Continue ReadingMaking GUI for SUSI Linux with PyGTK

GNOME.Asia Vietnam Wrap Up

GNOME.Asia Summit 2009 was a big success as one of the one of the very first Open Source conferences in South East Asia. The event took place on Nov 20 - 22, 2009 at Quang Trung Software Park in Ho Chi Minh City, Vietnam. Quang Trung Software Park is a home of more than 200 tech-companies (including local start-ups, multi-nationals, and state-owned companies such as FDI). The conference was organized by the GNOME.Asia community in cooperation with the organization team in Vietnam. The Ho Chi Minh City government supported the event through the Department of Information and Communications Technology. Numbers and facts * 1000+ attendees * 79 speakers * 138 volunteers * 5 keynotes * 109 presentations * 25 lightning talks * 17 workshops Main Tracks Six tracks were organized in parallel during the 3-day conference. The focus was only on GNOME technologies and desktop deployments based on GNOME  but also a variety of topics including: * GNOME 3.0 * GNOME library and application development * Localization & Internationalization * Mobile platforms and thin clients * Desktop deployments * School software In addition to the majority of software presentations, hardware talks such as 'How to build an Open Source printer' by Frederic Muller gathered a big interest. Workshops A focus of the workshops were applications for thin clients, localization and translation for Asian users. In parallel, there was also Linux course for beginners, map party, installation fest, and Ubuntu release party which was organized by the Vietnamese Ubuntu user group. Women in IT Panel Unlike many tech-conferences around the world, more than 50% of GNOME.Asia 2009 participants were female. They were young, curious and enthusiastic. Therefore the "Women in IT" Panel was somewhat overwhelmed with tons of questions. Stormy Peters from the US, chair of GNOME.Asia, shared her inspired story of being a mother, a housewife, an employee, an active open source contributor and a chair of the GNOME Foundation. Pockey Lam and Emily Chen, two founders of the Beijing linux users group explained how to start, grow and maintain a successful open source community. Hong Phuc Dang, who brought the first open source conference to Vietnam spoke of how her open source journey was started and encouraged female audience to explore the beauty and value of sharing, openness and collaboration which can be found easily in an open source community. Mini job fair A mini job fair was organized at the conference site with 15 companies on board. Every year thousands of computer science fresh-graduates in Vietnam are seeking for job opportunities in the tech field. Less 20% is able to get a right job of his/her major. More than 80% is forced to start their career in a non-tech environment. The idea of the job fair is (1) to provide a platform where tech companies can announce their vacant positions, recruitment process, job requirements, expectation; (2) to organize a meeting place of employers and their potential employees; (3) to foster knowledge sharing community which aims to help students prepare themselves with skill sets that fit the current marketplace. Vietnam - a great host country Visitors from oversea could not be…

Continue ReadingGNOME.Asia Vietnam Wrap Up