google2ubuntu documentation

Class interface

class interface.interface[source]

@description: This class start the osd server, then start recording your voice before asking Google for the translation. Then, the result is parsing in order to execute the associated action

sendto()[source]

@function: Send the flac file to Google and start the parser

Class basicCommands

class basicCommands.basicCommands(text, PID)[source]

@description: Called when the user wants to start an internal command for the moment there is 3 internal commands:

  • time
  • clipboard
  • hour
@param text
name of the function to launch
@param PID
the program’s pid to synchronize osd notification
read_clipboard()[source]

@description: A function to make google2ubuntu reads the selected text

getTime()[source]

@description: a function that let google2ubuntu read and display the current timme

getPower()[source]

@description: a function that let google2ubuntu read and display the current power state

Class workWithModule

class workWithModule.workWithModule(module_path, module_name, text, PID)[source]

@description: This class allows you to call external modules. If a call for an external module is detected by the parser then this class check the module’s config file before extracting modules’s parameter from the text you have pronounced

Class ArgsWindow

class ArgsWindow.ArgsWindow(module, name, store)[source]

@description: Display a window to help the user create a config for a module

@param module
module’s folder
@param name
module’s name
@param store
a Gtk.Listore in which we will append a new line for this module
do_clicked(button, module, name, store)[source]

@description: callback function called when the user want to finish the configuration of the module. If everything is ok then the config file is written at the right place

Class add_window

class add_window.add_window[source]

@description: This class allow the user to manage all his commands thanks to a treeview. The grid generated will be added to the window

get_grid()[source]

@description: get the grid

@return a Gtk.Grid

on_drag_data_received(widget, context, x, y, Selection, target_type, timestamp, store)[source]

@description: The treeview allows dnd so, if the user select a file then the process to add a module start and finally a new line is added to the treeview. If the user select a folder then a new line is added to the treeview with a command to open this folder

@param: widget
the widget that support dnd
@param: Selection
the item selected
@param: store
the listStore to append the new entry
show_label(action)[source]

@description: Show or hide the bottom label

@param: action
a string ‘show’ or ‘hide’
command_edited(widget, path, text, store)[source]

@description: callback function called when the user edited the command field of the treeview, we need to modify the liststore

@param: widget
a Gtk.Widget
@param: path
the way to find the modifiyed item
@param: text
the new text
@param: store
the listStore to modify
key_edited(widget, path, text, store)[source]

@description: same thing that the previous function

on_changed(selection)[source]

@description: hide the bottom label when the selection change

@param: selection
the selection from the treeview

@return: a boolean

create_toolbar(store)[source]

@description: create the toolbar of the main window

@param: store
the listStore to connect to some buttons

@return: a Gtk.toolbar

get_combobox()[source]

@description: get the combobox of the toolbar

@return: a Gtk.Combobox

on_combochanged(combo)[source]

@description: the combobox is used to filter the treeview and switch between different commands types

match_func(model, iterr, data=None)[source]

@description: we get the combobox selection and filter the treeview data thanks to this selection.

@return: a boolean

add_clicked(button, store, add_type)[source]

@description: callback function called when the user want to add command

@param: button
the button that has to be clicked
@param: store
the listStore that will contain a new entry
@param: add_type
the type of the new command to add
addModule(store, module)[source]

@description: function that adds a module

@param: store
the listStore that will receive a new entry
@param: module
the path of the executable file of the module
remove_clicked(button, store)[source]

@description: callback function called wnen the user want to remove a line of the treeview

@param: button
the button that will be clicked
@param: store
the listStore that is going to be modify
removeall_clicked(button, store)[source]

@description: Same as the past function but remove all lines of the treeview

try_command(button, store)[source]

@description: try a command (bash)

@param: button
the button that has to be clicked
@param: store
the listStore
help_clicked(button)[source]

@description: show the help window

@param: button
the button that has to be clicked
populate_store(store)[source]

@description: load the treeview from the google2ubuntu.xml file or from the default.xml file

@param: store
the listStore that will be modify
saveTree(store)[source]

@description: save the treeview in the google2ubuntu.xml file

@param: store
the listStore attach to the treeview

Class Googletts

class Googletts.tts(text)[source]

@description: Let google2ubuntu to use the Google tts API

@param: the text to read to the user

Class HelpWindow

class HelpWindow.HelpWindow[source]

@description: Diaplay an help window

on_close(action, parameter)[source]

@description: function called when the user wants to close the window

@param: action
the window to close

Class MainWindow

class MainWindow.MainWindow(app)[source]

@description: This class display the main window that the user will see when he wants to manage his commands

Class moduleSelection

class moduleSelection.moduleSelection[source]

@description: This class display an fileChooserDialog when the user wants to add a new module from the menu of the main window

getModule()[source]

@description: return the module selected

@return: return the path to the executable of the module

Class stringParser

class stringParser.stringParser(text, File, PID)[source]

@description: This class parses the text retrieve by Google in order to distinguish external commands, internal commands and modules