# Path: vocto/command_helpers.py
# def quote(str):
#     ''' encode spaces and comma '''
#     return None if not str else str.replace('\\', '\\\\').replace(' ','\\s').replace('|','\\v').replace(',','\\c').replace('\n','\\n')
# 
# def dequote(str):
#     ''' decode spaces and comma '''
#     return None if not str else str.replace('\\n','\n').replace('\\c', ',').replace('\\v', '|').replace('\\s', ' ').replace('\\\\', '\\')
# 
# def str2bool(str):
#     return str.lower() in [ 'true', 'yes', 'visible', 'show', '1' ]


import os
import logging
import lib.connection as Connection
from gi.repository import Gtk
from lib.config import Config
from lib.uibuilder import UiBuilder
from lib.toolbar.widgets import Widgets
from datetime import datetime, timedelta
from vocto.command_helpers import quote, dequote, str2bool
            uibuilder.get_check_widget('box_insert').show()
        else:
            # hide insert tool bar
            uibuilder.get_check_widget('box_insert').hide()

        # Hint: self.initialized will be set to True in response to 'get_overlay'

    def on_insert_toggled(self, btn):
        # can't select insert, if we got no list already
        if not self.initialized:
            return
        Connection.send('show_overlay', str(self.insert.get_active()))

    def on_inserts_changed(self, combobox):
        ''' new insert was selected
        '''
        # can't select insert, if we got no list already
        if not self.initialized:
            return
        # check if there is any useful selection
        if self.inserts.get_active_iter():
            # get name of the selection
            selected_overlay = self.inserts_store[self.inserts.get_active_iter(
            )][0]
            # tell log about user selection
            self.log.info("setting overlay to '%s'", selected_overlay)
            # hide overlay if 'AUTO-OFF' is selected
            if self.isAutoOff():
                Connection.send('show_overlay', str(False))
            # select overlay on voctocore

# Path: vocto/command_helpers.py
# def quote(str):
#     ''' encode spaces and comma '''
#     return None if not str else str.replace('\\', '\\\\').replace(' ','\\s').replace('|','\\v').replace(',','\\c').replace('\n','\\n')
# 
# def dequote(str):
#     ''' decode spaces and comma '''
#     return None if not str else str.replace('\\n','\n').replace('\\c', ',').replace('\\v', '|').replace('\\s', ' ').replace('\\\\', '\\')
# 
# def str2bool(str):
#     return str.lower() in [ 'true', 'yes', 'visible', 'show', '1' ]


# Path: voctogui/lib/toolbar/overlay.py
import os
import logging
import lib.connection as Connection
from gi.repository import Gtk
from lib.config import Config
from lib.uibuilder import UiBuilder
from lib.toolbar.widgets import Widgets
from datetime import datetime, timedelta
from vocto.command_helpers import quote, dequote, str2bool

            uibuilder.get_check_widget('box_insert').show()
        else:
            # hide insert tool bar
            uibuilder.get_check_widget('box_insert').hide()

        # Hint: self.initialized will be set to True in response to 'get_overlay'

    def on_insert_toggled(self, btn):
        # can't select insert, if we got no list already
        if not self.initialized:
            return
        Connection.send('show_overlay', str(self.insert.get_active()))

    def on_inserts_changed(self, combobox):
        ''' new insert was selected
        '''
        # can't select insert, if we got no list already
        if not self.initialized:
            return
        # check if there is any useful selection
        if self.inserts.get_active_iter():
            # get name of the selection
            selected_overlay = self.inserts_store[self.inserts.get_active_iter(
            )][0]
            # tell log about user selection
            self.log.info("setting overlay to '%s'", selected_overlay)
            # hide overlay if 'AUTO-OFF' is selected
            if self.isAutoOff():
                Connection.send('show_overlay', str(False))
            # select overlay on voctocore

            Connection.send('set_overlay', quote(str(selected_overlay)))