def main(): vncharsets.init() Notify.init("IBus BoGo Settings") app = QApplication(sys.argv) settings = Settings(config_path) win = Window(app, settings) win.show() app.exec_() sys.exit()
def main(): vncharsets.init() Notify.init("IBus BoGo Settings") app = QApplication(sys.argv) settings = Settings(CONFIG_PATH) win = Window(app, settings) win.show() import signal signal.signal(signal.SIGINT, signal.SIG_DFL) app.exec_()
import vncharsets from nose.tools import eq_ import os vncharsets.init() def _gp(path): """ Good path. Returns an absolute path from the relative path. """ return os.path.join(os.path.dirname(__file__), path) def test_encode_string(): eq_("tưởng niệm".encode("tcvn3"), b"t\xAD\xEBng ni\xD6m") def test_decode_string(): utf8 = open(_gp('CONTRIBUTE.utf-8')).read() with open(_gp('CONTRIBUTE.tcvn3')) as f: tcvn3 = f.buffer.read() eq_(b"t\xAD\xEBng ni\xD6m".decode("tcvn3"), "tưởng niệm") eq_("em bò ñieân, xin ñöøng ñaùnh em".encode('latin-1').decode('vni'), "em bị điên, xin đừng đánh em") eq_(open(_gp('CONTRIBUTE.tcvn3'), encoding="tcvn3").read(), utf8) eq_(open(_gp('CONTRIBUTE.vni-win'), encoding="vni").read(), utf8) eq_(utf8.encode("tcvn3"), tcvn3)
from gi.repository import Wnck import time import logging import subprocess import sys import os sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import bogo from config import Config from keysyms_mapping import mapping import vncharsets vncharsets.init() # Syntactic sugar keysyms = IBus modifier = IBus.ModifierType # I know, I know. Singleton/global objects are horrible but # right now there is no known way to pass more args to Engine # because of how python-gobject works. # TODO: We should be able to subclass # IBusFactory and pre-apply the config object as an argument to # our engine's constructor. config = Config() last_engine = None engines = []