コード例 #1
0
# 'init' has one array which is [keysym, keycode, modifier] and to be run
# before the main tests. E.g.
# Ctrl-space to enable Hiragana mode
#
# 'tests' cases are the main test cases.
# 'preedit' case runs to create a preedit text.
# 'lookup' case runs to update a lookup table.
# 'commit' case runs to commit the preedit text.
# 'result' case is the expected output.
# 'preedit', 'lookup', 'commit' can choose the type of either 'string' or 'keys'
# 'string' type is a string sequence which does not need modifiers

from gi import require_version as gi_require_version  # type: ignore

gi_require_version('IBus', '1.0')
from gi.repository import IBus  # type: ignore

TestCases = {
    #'init': [IBus.KEY_j, 0, IBus.ModifierType.CONTROL_MASK],
    'tests': [
        {
            'preedit': {
                'string': 'defaut'
            },
            'lookup': {
                'keys': [[IBus.KEY_Tab, 0, 0]]
            },
            'commit': {
                'keys': [[IBus.KEY_space, 0, 0]]
            },
コード例 #2
0
ファイル: gladerrad.py プロジェクト: Xoristzatziki/GladerRAD
ERROR_GLADE_FILE_READ = -4


def import_Gtk_failed(err):
    """ Fail with a friendlier message when imports fail. """
    msglines = (
        '{namever} requires some third-party libraries.',
        'Please install requirements using \'pip\' or your package manager.',
        'The import error was:', '    {err}\n')
    print('\n'.join(msglines).format(namever=VERSIONSTR, err=err))
    sys.exit(ERROR_IMPORT_GTK_FAIL)


try:
    from gi import require_version as gi_require_version
    gi_require_version('Gtk', '3.0')
    from gi.repository import Gtk
except ImportError as eximp:
    import_Gtk_failed(eximp)


#If Gtk is imported then we can show a Gtk.MessageDialog
# for other imports.
def import_fail(err):
    """ Fail with a Gtk.MessageDialog message when imports fail. """
    msglines = (
        '{namever} requires some third-party libraries.',
        'Please install requirements using \'pip\' or your package manager.',
        'The import error was:', '    {err}\n')
    themessage = '\n'.join(msglines).format(namever=VERSIONSTR, err=err)
    print(themessage)
コード例 #3
0
ファイル: bookmarks.py プロジェクト: zepto/webbrowser2
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


""" Classes used by both processes.

"""

from gi import require_version as gi_require_version
gi_require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject, Gdk, GLib, Pango, Gio
import pathlib
from xml.etree import ElementTree as etree
import logging
from functools import partial
from http.client import HTTPConnection
from urllib.parse import urlparse
import urllib.request as urlrequest
from urllib.error import URLError, HTTPError


class Bookmarks(object):
    """ Simple xbel bookmark object.

    """
コード例 #4
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import sys

from gi import require_version as gi_require_version
gi_require_version('Gio', '2.0')
gi_require_version('GLib', '2.0')
gi_require_version('IBus', '1.0')

from gi.repository import Gio
from gi.repository import GLib
from gi.repository import GObject
from gi.repository import IBus


class DictItem():
    def __init__(self,
                 id='',
                 short_label='',
                 long_label='',
                 icon='',
コード例 #5
0
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Auxiliary classes.  If not, see <http://www.gnu.org/licenses/>.
"""

#FIXME: correct the version
__version__ = '0.0.20'
VERSIONSTR = 'v. {}'.format(__version__)

ERROR_IMPORT_LIBRARIES_FAIL = -1

try:
    import os
    from gi import require_version as gi_require_version
    gi_require_version('Gtk', '3.0')
    from gi.repository import Gtk
    from configparser import ConfigParser
    import locale
    from locale import gettext as _
except ImportError as eximp:
    print(eximp)
    sys.exit(ERROR_IMPORT_LIBRARIES_FAIL)

settings = None # Keep window related options
options = None #Keep application wide options in a 'General Options' section

class MessageBox():
    def __init__(self, parent):
        self.parent = parent
        self.app = self.parent.app
コード例 #6
0
class GladeFile(object):
    """ Parses a glade file and generates a python source file based on
        objects and signal handlers found in the xml.
        Signal handler arguments are looked up by inspecting the Gtk
        widgets and their ArgInfo.
        Holds a collection of ObjectInfos with helper methods.

    """
    # Xpath to find all <object> elements in a glade file.
    xpath_object = CSSSelector('object').path

    # Main template for output file.
    template = """#!/usr/bin/env python3
\"\"\"
    ...
    {date}
\"\"\"

import os
import sys
from gi import require_version as gi_require_version
gi_require_version('Gtk', '3.0')
from gi.repository import Gtk

NAME = 'GtkApp'
__version__ = '0.0.1'
VERSIONSTR = '{{}} v. {{}}'.format(NAME, __version__)


class App(Gtk.Window):
    \"\"\" Main window with all components. \"\"\"

    def __init__(self):
        Gtk.Window.__init__(self)
        self.builder = Gtk.Builder()
        gladefile = '{filename}'
        if not os.path.exists(gladefile):
            # Look for glade file in this project's directory.
            gladefile = os.path.join(sys.path[0], gladefile)

        try:
            self.builder.add_from_file(gladefile)
        except Exception as ex:
            print('\\nError building main window!\\n{{}}'.format(ex))
            sys.exit(1)

        # Get gui objects
{objects}

        # Connect all signals.
        self.builder.connect_signals(self)

        # Show the main window.
        self.{mainwindow}.show_all()

{set_object_def}{signaldefs}


def main():
    \"\"\" Main entry point for the program. \"\"\"
    app = App()  # noqa
    return Gtk.main()


if __name__ == '__main__':
    mainret = main()
    sys.exit(mainret)
"""

    # Function definition for set_object() when dynamic init is used.
    set_object_def = """
    def set_object(self, objname):
        \"\"\" Try building an object by it's name. \"\"\"

        if objname:
            obj = self.builder.get_object(objname)
            if obj:
                setattr(self, objname, obj)
            else:
                print('\\nError setting object!: {{}}'.format(objname))

"""

    def __init__(self, filename=None, dynamic_init=False):
        """ Create a GladeFile to generate code from.
            Arguments:
                filename      : File to parse.
                dynamic_init  : If true, generated code will dynamically
                                create objects:
                                    objects = ('obj1', 'obj2')
                                    for objname in objects:
                                        self.set_object(objname)

                                Otherwise, the normal method will be used:
                                    self.obj = self.builder.get_object('obj')

                                Both achieve the same end result.
        """
        self.filename = filename
        self.dynamic_init = dynamic_init

        if filename:
            self.objects = GladeFile.objects_from_glade(filename)
        else:
            self.objects = []

    def __bool__(self):
        """ bool(GladeFile) is based on object count.
            No objects = False
        """
        return bool(self.objects)

    def __repr__(self):
        """ Return a repr() for this GladeFile for debugging purposes. """
        return '\n'.join((repr(o) for o in self.objects))

    def __str__(self):
        """ Return a str() for this GladeFile. """
        return (
            '{filename}: {objects} objects with {handlers} handlers'.format(
                filename=self.filename,
                objects=len(self.objects),
                handlers=sum((len(o.signals) for o in self.objects))))

    def format_tuple_names(self, indent=12):
        """ Format object names as if they were inside a tuple definition. """
        fmtname = '{space}\'{{name}}\','.format(space=' ' * indent)
        return '\n'.join((fmtname.format(name=n) for n in self.names()))

    def get_content(self):
        """ Renders the main template with current GladeFile info.
            Returns a string that can be written to file.
        """
        if self.dynamic_init:
            template = """        guinames = (
{}
        )
        for objname in guinames:
            self.set_object(objname)"""

            objects = template.format(self.format_tuple_names(indent=12))
            setobj_def = GladeFile.set_object_def
        else:
            # Regular init.
            objects = self.init_codes(indent=8)
            setobj_def = ''

        return GladeFile.template.format(
            date=datetime.today().strftime('%m-%d-%Y'),
            filename=self.filename,
            objects=objects,
            set_object_def=setobj_def,
            signaldefs=self.signal_defs(indent=4),
            mainwindow=self.get_main_window())

    def get_object(self, name, default=None):
        """ Retrieve an ObjectInfo by object name. """
        for o in self.objects:
            if o.name == name:
                return o
        return default

    def get_main_window(self):
        """ Inspect all objects, return the name for the first one that
            looks like the main window object.
            Returns '?MainWindow?' on failure, so any generated code
            will immediately raise an exception when ran.
        """
        windows = [o.name for o in self.objects if 'win' in o.name.lower()]
        if not windows:
            return '?MainWindow?'
        if len(windows) == 1:
            # Only one win object.
            return windows[0]
        # Search for any 'main' window.
        for winname in windows:
            if 'main' in winname.lower():
                return winname

        # Can't find a 'main' window. Return the first one.
        return windows[0]

    def init_codes(self, indent=12):
        """ Returns concatenated init code for all objects. """
        spacing = ' ' * indent
        joiner = '\n{}'.format(spacing).join
        # Sorts the initialization code based on object name.
        initcodes = []
        for objname in self.names():
            obj = self.get_object(objname)
            initcodes.append(obj.init_code())

        return '{}{}'.format(spacing, joiner(initcodes))

    def make_executable(self, filename=None):
        """ Make a file executable, by setting mode 774. """
        filename = filename or self.filename
        # chmod 774
        mode774 = stat.S_IRWXU | stat.S_IRWXG | stat.S_IROTH
        os.chmod(filename, mode774)

    def names(self):
        """ Return a list of all object names. """
        return sorted([o.name for o in self.objects])

    @classmethod
    def objects_from_glade(cls, filename):
        """ Returns a list of ObjectInfo parsed from a glade file.
            Possibly raises errors from etree.parse(),
            or ValueError when no objects are found.
        """
        tree = etree.parse(filename)
        objectelems = tree.xpath(cls.xpath_object)
        if not objectelems:
            raise ValueError('No objects found.')

        objects = [ObjectInfo.from_element(e) for e in objectelems]
        # Remove separator objects.
        return [o for o in objects if not o.name.startswith('<')]

    def signal_defs(self, indent=4):
        """ Returns concatenated signal definitions for all objects. """
        # Sort the signal defs by object name.
        signaldefs = []
        for objname in self.names():
            o = self.get_object(objname)
            signaldef = o.signal_defs(indent=indent)
            if signaldef.strip():
                signaldefs.append(signaldef)
        return '\n\n'.join(signaldefs)

    def write_file(self, filename=None):
        """ Write parsed info to a file. """
        filename = filename or self.filename
        content = self.get_content()
        with open(filename, 'w') as f:
            f.write(content)

        self.make_executable(filename)
        return filename
コード例 #7
0
ファイル: main.py プロジェクト: sunpinyin/sunpinyin
# license." If you don't indicate a single choice of license, a recipient has the
# option to distribute your version of this file under either the CDDL or the LGPL
# Version 2.1, or to extend the choice of license to its licensees as provided
# above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
# Version 2 license, then the option applies only if the new code is made subject
# to such option by the copyright holder. 
#

import sys
import os
from os import path
try:
    import gtk
except ImportError:
    from gi import require_version as gi_require_version
    gi_require_version('Gtk', '3.0')
    from gi.repository import Gtk as gtk
try:
    import ibus
except ImportError:
    from gi import require_version as gi_require_version
    gi_require_version('IBus', '1.0')
    from gi.repository import IBus as ibus
import gettext
import locale

GETTEXT_PACKAGE="ibus-sunpinyin"
_ = lambda msg: gettext.gettext(msg)

XML_FILE = path.join(path.dirname(__file__), "setup.xml")
SEPARATOR = "/"
コード例 #8
0
from path import Path
from gi import require_version as gi_require_version
from multiprocessing import Process, Manager, Pipe
from multiprocessing import current_process
import multiprocessing
import json
import os
import re

gi_require_version('Gtk', '3.0')
gi_require_version('WebKit2', '4.0')


def test(url: str = 'https://inbox.google.com'):
    from gi.repository import WebKit2 as libwebkit
    from gi.repository import Gtk as gtk
    from gi.repository import GLib as glib


    webview = libwebkit.WebView()
    settings = webview.get_settings()
    settings.set_property('user-agent', '''Mozilla/5.0 (X11; Linux x86_64)
                           AppleWebKit/537.36 (KHTML, like Gecko)
                           Chrome/47.0.2526.106 Safari/537.36''')
    webview.load_uri(url)

    scroll = gtk.ScrolledWindow()
    scroll.set_policy(gtk.PolicyType.AUTOMATIC,gtk.PolicyType.AUTOMATIC)
    scroll.set_shadow_type(gtk.ShadowType.IN)

    window = gtk.Window()
コード例 #9
0
ファイル: app.py プロジェクト: jnweiger/lunatum
#       Copyright 2010 Andrew <andrew@karmic-desktop>
# Thanks for a great piece of software!
#
#  app.py -- main entrypoint
#

import os
import sys
import locale
import shutil
import gettext
import logging

from subprocess import Popen
from gi import require_version as gi_require_version
gi_require_version('Gst', '1.0')  # as suggested by a runtime PyGIWarning
from gi.repository import Gtk, Gdk, GObject
from gettext import gettext as _

# from kazam.utils import *
from lunatum.prefs import *
# from kazam.backend.grabber import Grabber
# from kazam.frontend.main_menu import MainMenu
# from kazam.frontend.window_area import AreaWindow
# from kazam.backend.gstreamer import Screencast
# from kazam.frontend.preferences import Preferences
# from kazam.frontend.about_dialog import AboutDialog
# from kazam.frontend.indicator import KazamIndicator
# from kazam.frontend.window_select import SelectWindow
# from kazam.frontend.done_recording import DoneRecording
# from kazam.frontend.window_outline import OutlineWindow
コード例 #10
0
ファイル: btfmgtk.py プロジェクト: mc6312/btfm
    BTFM is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    BTFM 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with BTFM.  If not, see <http://www.gnu.org/licenses/>."""

from gi import require_version as gi_require_version
gi_require_version('Gtk', '3.0')  # извращенцы!
from gi.repository import Gtk, Gdk, GObject, GLib, Pango, Gio
from gi.repository.GdkPixbuf import Pixbuf

import zipfile
from sys import stderr
import os.path

# отступы между виджетами, дабы не вырвало от пионерского вида гуя

__pangoContext = Gdk.pango_context_get()

WIDGET_BASE_UNIT = int(
    __pangoContext.get_metrics(__pangoContext.get_font_description(),
                               None).get_approximate_char_width() /
    Pango.SCALE)
コード例 #11
0
ファイル: glader_ui.py プロジェクト: welbornprod/glader
    Provides the user interface for Glader.
    -Christopher Welborn 09-15-2014
"""

import os
import sys
from glader_util import (
    import_fail,
    settings,
    GladeFile,
    NAME
)

try:
    from gi import require_version as gi_require_version
    gi_require_version('Gtk', '3.0')
    gi_require_version('GtkSource', '3.0')
    from gi.repository import Gtk, GtkSource, GObject, Pango
except ImportError as eximp:
    import_fail(eximp)


class App(Gtk.Window):

    """ Main window with all components. """

    def __init__(self, filename=None, outputfile=None, dynamic_init=False):
        Gtk.Window.__init__(self)
        self.builder = Gtk.Builder()
        # Register the GtkSourceView type.
        GObject.type_register(GtkSource.View)
コード例 #12
0
        'Missing some third-party libraries.',
        'Please install requirements using \'pip\' or your package manager.',
        'The import error was:', '    {}')
    print('\n'.join(msglines).format(err))
    sys.exit(ERROR_IMPORT_LIBRARIES_FAIL)


try:
    import os
    import sys
    import math
    from copy import deepcopy

    # Gtk and related
    from gi import require_version as gi_require_version
    gi_require_version('Gtk', '3.0')
    from gi.repository import Gtk
    from gi.repository import Gdk, GdkPixbuf, Pango
    import cairo
    gi_require_version('PangoCairo', '1.0')
    from gi.repository import PangoCairo

    # Configuration and message boxes
    from auxiliary import SectionConfig, OptionConfig
    from auxiliary import MessageBox

    # Localization
    import locale
    from locale import gettext as _

except ImportError as eximp:
コード例 #13
0
ファイル: pmvgmetadata.py プロジェクト: mc6312/photomvg
    PhotoMVG is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    PhotoMVG 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PhotoMVG.  If not, see <http://www.gnu.org/licenses/>."""

from gi import require_version as gi_require_version
gi_require_version('GExiv2', '0.10')
from gi.repository import GExiv2, GLib

import os, os.path
import datetime
from collections import namedtuple
import re

from pmvgcommon import *


class FileTypes():
    """Вспомогательный класс для определения типа файла по расширению."""

    DIRECTORY, IMAGE, RAW_IMAGE, VIDEO = range(4)
    # тип "DIRECTORY" в этом модуле не используется, нужен для GUI
コード例 #14
0
from gi import require_version as gi_require_version
from multiprocessing import Process, Manager, Pipe
from multiprocessing import current_process
import multiprocessing
import json
import os
import re

gi_require_version('Soup', '2.4')
gi_require_version('Gtk', '3.0')
gi_require_version('WebKit', '3.0')


def test(url: str = 'https://inbox.google.com'):
    from gi.repository import Soup as libsoup
    from gi.repository import WebKit as libwebkit
    from gi.repository import Gtk as gtk
    from gi.repository import GLib as glib

    # proxy_uri = libsoup.URI.new(os.getenv('http_proxy'))
    # session = libwebkit.get_default_session()
    # session.set_property('proxy-uri', proxy_uri)

    webview = libwebkit.WebView()
    settings = webview.get_settings()
    settings.set_property(
        'user-agent', '''Mozilla/5.0 (X11; Linux x86_64)
                           AppleWebKit/537.36 (KHTML, like Gecko)
                           Chrome/47.0.2526.106 Safari/537.36''')
    webview.load_uri(url)
コード例 #15
0
ファイル: prefs.py プロジェクト: julroy67/ibus-anthy
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import sys

from gi import require_version as gi_require_version

gi_require_version("GLib", "2.0")
gi_require_version("IBus", "1.0")

from gi.repository import GLib
from gi.repository import IBus


class Prefs(object):
    _prefix = "engine/dummy"

    def __init__(self, bus=None, config=None):
        self.default = {}
        self.modified = {}
        self.new = {}
        self.__no_key_warning = False
コード例 #16
0
    PhotoStat is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    PhotoStat 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PhotoStat.  If not, see <http://www.gnu.org/licenses/>."""

from gi import require_version as gi_require_version

gi_require_version('GExiv2', '0.10')  # только чтоб не лаялось...
from gi.repository import GExiv2

GExiv2.log_set_level(GExiv2.LogLevel.MUTE)

import os, os.path
import datetime
from time import time
from fractions import Fraction

import pstat_config
from pstat_common import *

from warnings import warn

# "служебные" значения для ФР и диафрагмы
コード例 #17
0
ファイル: main2.py プロジェクト: epico/ibus-libpinyin
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from __future__ import print_function

import gettext

import locale
import os
import sys

from gi import require_version as gi_require_version
gi_require_version('GLib', '2.0')
gi_require_version('Gio', '2.0')
gi_require_version('Gtk', '3.0')
gi_require_version('IBus', '1.0')

from gi.repository import GLib
from gi.repository import Gio

# set_prgname before importing other modules to show the name in warning
# messages when import modules are failed. E.g. Gtk.
GLib.set_prgname('ibus-setup-libpinyin')

from gi.repository import Gtk
from gi.repository import IBus

import config
コード例 #18
0
ファイル: main.py プロジェクト: zerng07/ibus-libzhuyin
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

from __future__ import print_function

import gettext

import locale
import os
import sys

from gi import require_version as gi_require_version
gi_require_version('GLib', '2.0')
gi_require_version('Gtk', '3.0')
gi_require_version('IBus', '1.0')

from gi.repository import GLib

# set_prgname before importing other modules to show the name in warning
# messages when import modules are failed. E.g. Gtk.
GLib.set_prgname('ibus-setup-libzhuyin')

from gi.repository import Gtk
from gi.repository import IBus

import config

locale.setlocale(locale.LC_ALL, "")
コード例 #19
0
ファイル: webkit_test.py プロジェクト: zepto/webbrowser2
from path import Path
from gi import require_version as gi_require_version
from multiprocessing import Process, Manager, Pipe
from multiprocessing import current_process
import multiprocessing
import json
import os
import re

gi_require_version('Soup', '2.4')
gi_require_version('Gtk', '3.0')
gi_require_version('WebKit', '3.0')


def test(url: str = 'https://inbox.google.com'):
    from gi.repository import Soup as libsoup
    from gi.repository import WebKit as libwebkit
    from gi.repository import Gtk as gtk
    from gi.repository import GLib as glib


    # proxy_uri = libsoup.URI.new(os.getenv('http_proxy'))
    # session = libwebkit.get_default_session()
    # session.set_property('proxy-uri', proxy_uri)

    webview = libwebkit.WebView()
    settings = webview.get_settings()
    settings.set_property('user-agent', '''Mozilla/5.0 (X11; Linux x86_64)
                           AppleWebKit/537.36 (KHTML, like Gecko)
                           Chrome/47.0.2526.106 Safari/537.36''')
    webview.load_uri(url)
コード例 #20
0
ファイル: main.py プロジェクト: Keruspe/ibus-anthy
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import os
from os import path
import sys
import getopt
import locale
import xml.dom.minidom

from gi import require_version as gi_require_version
gi_require_version('GLib', '2.0')
gi_require_version('IBus', '1.0')

from gi.repository import GLib

# set_prgname before importing factory to show the name in warning
# messages when import modules are failed. E.g. Gtk.
GLib.set_prgname('ibus-engine-anthy')

from gi.repository import IBus

import _config as config
import factory

class IMApp:
    def __init__(self, exec_by_ibus):
コード例 #21
0
"""
Quick Launch Menu
"""

import signal
import os
from subprocess import call
from yaml import load as yaml_load

from gi import require_version as gi_require_version
gi_require_version('Gtk', '3.0')
gi_require_version('AppIndicator3', '0.1')
gi_require_version('Notify', '0.7')

from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
from gi.repository import Notify as notify


class AppConfig(object):
    """
    App configuration.
    """

    def __init__(self, config_file_path):
        """
        Ctor.
        """
        try:
            raw = open(config_file_path).read()
        except IOError: