コード例 #1
0
ファイル: helpers.py プロジェクト: CSRedRat/magicicada-gui
def build_icon_dict(image_size):
    """Return a dict with icons for 'image_size'."""
    result = {}

    for style in ('idle', 'working', 'alert'):
        fname = get_data_file('media', 'icon-%s-%s.png' % (style, image_size))
        result[style] = GdkPixbuf.Pixbuf.new_from_file(fname)

    return result
コード例 #2
0
ファイル: helpers.py プロジェクト: CSRedRat/magicicada-gui
def get_builder(builder_file_name):
    """Return a fully-instantiated Gtk.Builder instance from specified ui file.

    :param builder_file_name: The name of the builder file, without extension.
        Assumed to be in the 'ui' directory under the data path.
    """
    # Look for the ui file that describes the user interface.
    ui_filename = get_data_file('ui', builder_file_name)
    if not os.path.exists(ui_filename):
        ui_filename = None

    builder = Gtk.Builder()
    builder.set_translation_domain('magicicada')
    builder.add_from_file(ui_filename)
    return builder