Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Gimp/plug-ins/python/   (Gimp Bildeditor Version 3.2.0©)  Datei vom 14.2.2026 mit Größe 2 kB image not shown  

Quelle  python-eval.py   Sprache: Python

 

#!/usr/bin/env python3

#   Gimp-Python - allows the writing of Gimp plugins in Python.
#   Copyright (C) 2006  Manish Singh <yosh@gimp.org>
#
#   This program 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.
#
#   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 <https://www.gnu.org/licenses/>.

import gi
gi.require_version('Babl', '0.1')
from gi.repository import Babl
gi.require_version('Gegl', '0.4')
from gi.repository import Gegl
gi.require_version('Gimp', '3.0')
from gi.repository import Gimp
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio

import sys
import traceback


def code_eval(procedure, run_mode, code, config, data):
    retval = Gimp.PDBStatusType.SUCCESS
    gerror = GLib.Error()

    if code == '-':
      code = sys.stdin.read()

    try:
      exec(code, globals())
    except Exception as error:
      retval = Gimp.PDBStatusType.CALLING_ERROR
      gerror = GLib.Error(traceback.format_exc())

    return procedure.new_return_values(retval, gerror)

class PythonEval (Gimp.PlugIn):
    ## GimpPlugIn virtual methods ##
    def do_set_i18n(self, procname):
        return True, 'gimp30-python', None

    def do_query_procedures(self):
        return ['python-fu-eval']

    def do_create_procedure(self, name):
        procedure = Gimp.BatchProcedure.new(self, name, "Python 3",
                                            Gimp.PDBProcType.PLUGIN,
                                            code_eval, None)
        procedure.set_documentation ("Evaluate Python code",
                                     "Evaluate python code under the python interpreter (primarily for batch mode)",
                                     name)

        procedure.set_attribution("Manish Singh",
                                  "Manish Singh",
                                  "2006")

        return procedure


Gimp.main(PythonEval.__gtype__, sys.argv)

Messung
CHZG
981009898

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.