__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
# vim:et sw=4 sts=4 sw=4
#
# ibus-table - The Tables engine for IBus
#
# Copyright (c) 2008-2009 Yu Yuwei <[email protected]>
# Copyright (c) 2009-2014 Caius "kaio" CHANCE <[email protected]>
# Copyright (c) 2012-2015, 2021-2022 Mike FABIAN <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>

from typing import Dict
from typing import Optional
import os
import re
import logging
from gettext import dgettext
_ = lambda a: dgettext("ibus-table", a)
N_ = lambda a: a
from gi import require_version # type: ignore
require_version('IBus', '1.0')
from gi.repository import IBus # type: ignore
import table
import tabsqlitedb

LOGGER = logging.getLogger('ibus-table')

DEBUG_LEVEL = int(0)

class EngineFactory(IBus.Factory): # type: ignore
    """Table IM Engine Factory"""
    def __init__(self, bus: IBus.Bus, db: str = '') -> None:
        global DEBUG_LEVEL
        try:
            DEBUG_LEVEL = int(str(os.getenv('IBUS_TABLE_DEBUG_LEVEL')))
        except (TypeError, ValueError):
            DEBUG_LEVEL = int(0)
        if DEBUG_LEVEL > 1:
            LOGGER.debug('EngineFactory.__init__(bus=%s, db=%s)\n', bus, db)
        self.db: Optional[tabsqlitedb.TabSqliteDb] = None
        self.dbdict: Dict[str, tabsqlitedb.TabSqliteDb] = {}
        # db is the full path to the sql database
        if db:
            self.dbusname = os.path.basename(db).replace('.db', '')
            udb = os.path.basename(db).replace('.db', '-user.db')
            self.db = tabsqlitedb.TabSqliteDb(filename=db, user_db=udb)
            self.db.db.commit()
            self.dbdict = {self.dbusname:self.db}

        # init factory
        self.bus = bus
        super().__init__(connection=bus.get_connection(),
                         object_path=IBus.PATH_FACTORY)
        self.engine_id = 0
        self.engine_path = ''

    def do_create_engine(self, engine_name: str) -> table.TabEngine:
        if DEBUG_LEVEL > 1:
            LOGGER.debug(
                'EngineFactory.do_create_engine(engine_name=%s)\n',
                engine_name)
        engine_name = re.sub(r'^table:', '', engine_name)
        engine_base_path = "/com/redhat/IBus/engines/table/%s/engine/"
        path_patt = re.compile(r'[^a-zA-Z0-9_/]')
        self.engine_path = engine_base_path % path_patt.sub('_', engine_name)
        try:
            if not self.db:
                # first check self.dbdict
                if engine_name not in self.dbdict:
                    db_dir = '/usr/share/ibus-table/tables'
                    if os.getenv('IBUS_TABLE_LOCATION'):
                        db_dir = os.path.join(
                            str(os.getenv('IBUS_TABLE_LOCATION')), 'tables')
                    db = os.path.join(db_dir, engine_name+'.db')
                    udb = engine_name+'-user.db'
                    if not os.path.exists(db):
                        byo_db_dir = os.path.expanduser('~/.ibus/byo-tables')
                        db = os.path.join(byo_db_dir, engine_name + '.db')
                    _sq_db = tabsqlitedb.TabSqliteDb(filename=db, user_db=udb)
                    _sq_db.db.commit()
                    self.dbdict[engine_name] = _sq_db

            engine = table.TabEngine(self.bus,
                                     self.engine_path + str(self.engine_id),
                                     self.dbdict[engine_name])
            self.engine_id += 1
            #return engine.get_dbus_object()
            return engine
        except:
            LOGGER.exception('failed to create engine %s', engine_name)
            raise Exception('Cannot create engine %s' %engine_name)

    def do_destroy(self) -> None:
        '''Destructor, which finish some task for IME'''
        if DEBUG_LEVEL > 1:
            LOGGER.debug('EngineFactory.do_destroy()\n')
        #
        ## we need to sync the temp userdb in memory to the user_db on disk
        for _db in self.dbdict:
            self.dbdict[_db].sync_usrdb()
        ##print "Have synced user db\n"
        super().destroy()

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
chinese_variants.py File 185.11 KB 0644
factory.py File 4.51 KB 0644
ibus_table_location.py File 4.13 KB 0644
it_active_window.py File 13.14 KB 0644
it_sound.py File 17.76 KB 0644
it_util.py File 38.19 KB 0644
main.py File 13.75 KB 0644
tabcreatedb.py File 18.88 KB 0644
table.py File 180.52 KB 0644
tabsqlitedb.py File 66.95 KB 0644
version.py File 1 KB 0644
Filemanager