[dia] l10n: mark python plugin string for translation
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] l10n: mark python plugin string for translation
- Date: Sat, 14 Dec 2019 15:56:56 +0000 (UTC)
commit 6745eec07d0442171d9ac7cf718e287b2a5650f2
Author: Zander Brown <zbrown gnome org>
Date: Sat Dec 14 15:54:07 2019 +0000
l10n: mark python plugin string for translation
Fix https://gitlab.gnome.org/GNOME/dia/issues/438
Most of these should move away from python (and of course the plugin system is changing)
app/find-and-replace.c | 6 +---
objects/UML/class.c | 2 +-
plug-ins/python/allprops.py | 11 ++++---
plug-ins/python/allsheets.py | 5 +++-
plug-ins/python/aobjects.py | 7 +++--
plug-ins/python/arrange.py | 5 +++-
plug-ins/python/autolayoutforce.py | 11 ++++---
plug-ins/python/bbox.py | 7 +++--
plug-ins/python/codegen.py | 59 ++++++++++++++++++++------------------
plug-ins/python/debug_objects.py | 7 +++--
plug-ins/python/dia_rotate.py | 15 ++++++----
plug-ins/python/diadissect.py | 5 +++-
plug-ins/python/diagx.py | 33 +++++++++++----------
plug-ins/python/diastddia.py | 19 ++++++------
plug-ins/python/diasvg.py | 11 ++++---
plug-ins/python/diasvg_import.py | 51 ++++++++++++++++----------------
plug-ins/python/dot.py | 9 ++++--
plug-ins/python/dot2dia.py | 17 ++++++-----
plug-ins/python/doxrev.py | 31 +++++++++++---------
plug-ins/python/export-object.py | 5 +++-
plug-ins/python/export-render.py | 5 +++-
plug-ins/python/group_props.py | 11 ++++---
plug-ins/python/gtkcons.py | 12 ++++----
plug-ins/python/imgmap.py | 9 ++++--
plug-ins/python/mark-cps.py | 5 +++-
plug-ins/python/otypes.py | 15 ++++++----
plug-ins/python/pydiadoc.py | 9 ++++--
plug-ins/python/scascale.py | 9 ++++--
plug-ins/python/select_by.py | 19 ++++++------
plug-ins/python/select_empty.py | 5 +++-
plug-ins/python/uninline_data.py | 7 +++--
po/POTFILES.in | 30 +++++++++++++++++++
po/POTFILES.skip | 6 ----
33 files changed, 282 insertions(+), 176 deletions(-)
---
diff --git a/app/find-and-replace.c b/app/find-and-replace.c
index 5378542f..f87ff136 100644
--- a/app/find-and-replace.c
+++ b/app/find-and-replace.c
@@ -562,17 +562,13 @@ edit_replace_callback(GtkAction *action)
/* no static var, instead we are attaching the dialog to the diplay shell */
dialog = g_object_get_data (G_OBJECT (ddisp->shell), "edit-replace-dialog");
if (!dialog) {
- GtkWidget *button;
dialog = gtk_dialog_new_with_buttons (_("Replace"),
GTK_WINDOW (ddisp->shell),
GTK_DIALOG_DESTROY_WITH_PARENT,
_("_Close"), GTK_RESPONSE_CLOSE,
_("Replace _All"), RESPONSE_REPLACE_ALL,
+ _("_Replace"), RESPONSE_REPLACE,
NULL);
- /* not adding the button in the list above to modify it's text;
- * the default "Find and Replace" is just too long for my taste ;)
- */
- button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Replace"), RESPONSE_REPLACE);
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Find"), RESPONSE_FIND);
diff --git a/objects/UML/class.c b/objects/UML/class.c
index 4bbc00f7..4a0bb4e9 100644
--- a/objects/UML/class.c
+++ b/objects/UML/class.c
@@ -193,7 +193,7 @@ static PropDescription umlclass_props[] = {
PROP_NOTEBOOK_PAGE("templates", PROP_FLAG_DONT_MERGE | PROP_FLAG_NO_DEFAULTS, N_("Template Parameters")),
/* the naming is questionable, but kept for compatibility */
{ "templates", PROP_TYPE_DARRAY, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL | PROP_FLAG_DONT_MERGE |
PROP_FLAG_NO_DEFAULTS,
- N_(""), NULL, NULL /* umlformalparameters_extra */ },
+ "", NULL, NULL /* umlformalparameters_extra */ },
/* all this just to make the defaults selectable ... */
PROP_NOTEBOOK_PAGE("style", PROP_FLAG_DONT_MERGE, N_("Style")),
diff --git a/plug-ins/python/allprops.py b/plug-ins/python/allprops.py
index e88fade9..ab736365 100644
--- a/plug-ins/python/allprops.py
+++ b/plug-ins/python/allprops.py
@@ -20,7 +20,10 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import sys, dia, string
-
+
+import gettext
+_ = gettext.gettext
+
def allprops_cb(data, flags) :
# copied from otypes.py
@@ -75,11 +78,11 @@ def allprops_cb(data, flags) :
# alpha-numeric sorting by type; after by number of users
props_keys.sort (lambda a,b : len(props_by_name[b][1]) - len(props_by_name[a][1]))
props_keys.sort (lambda a,b : cmp(props_by_name[a][0].type, props_by_name[b][0].type))
-
+
almost_all = 98 * len(otypes) / 100 # 98 %
for pname in props_keys :
-
+
p, names = props_by_name[pname]
x = 0.0
@@ -126,6 +129,6 @@ def allprops_cb(data, flags) :
dia.message(0, "One name, one type?!\n" + string.join(name_type_clashes, "\n"))
return data
-dia.register_action ("HelpAllPropts", "All Object _Properties",
+dia.register_action ("HelpAllPropts", _("All Object _Properties"),
"/ToolboxMenu/Help/HelpExtensionStart",
allprops_cb)
diff --git a/plug-ins/python/allsheets.py b/plug-ins/python/allsheets.py
index 46627788..ba54ea77 100644
--- a/plug-ins/python/allsheets.py
+++ b/plug-ins/python/allsheets.py
@@ -21,6 +21,9 @@ import dia, os, string
import tempfile
import webbrowser
+import gettext
+_ = gettext.gettext
+
# Given a list of "sheet objects" return the common namespace of the object types
def so_get_namespace (sol) :
names = {}
@@ -79,6 +82,6 @@ def isheets_cb (data, flags) :
dia.message(0, "'" + path + "' saved.")
webbrowser.open('file://' + os.path.realpath(path))
-dia.register_action ("HelpInspectSheets", "Dia _Sheets Inspection",
+dia.register_action ("HelpInspectSheets", _("Dia _Sheets Inspection"),
"/ToolboxMenu/Help/HelpExtensionStart",
isheets_cb)
diff --git a/plug-ins/python/aobjects.py b/plug-ins/python/aobjects.py
index 31280486..d93ae170 100644
--- a/plug-ins/python/aobjects.py
+++ b/plug-ins/python/aobjects.py
@@ -21,6 +21,9 @@
import sys, dia, string
+import gettext
+_ = gettext.gettext
+
def set_object_string (o) :
keys = o.properties.keys()
for s in keys :
@@ -60,7 +63,7 @@ def aobjects_cb(data, flags) :
if packages.has_key(sp) :
packages[sp].append(s)
else :
- packages[sp] = [s]
+ packages[sp] = [s]
for sp in packages.keys() :
# add a layer per package
@@ -96,6 +99,6 @@ def aobjects_cb(data, flags) :
diagram.flush()
return data
-dia.register_action ("HelpAObjects", "All _Objects",
+dia.register_action ("HelpAObjects", _("All _Objects"),
"/ToolboxMenu/Help/HelpExtensionStart",
aobjects_cb)
diff --git a/plug-ins/python/arrange.py b/plug-ins/python/arrange.py
index b18ba04b..7d830341 100644
--- a/plug-ins/python/arrange.py
+++ b/plug-ins/python/arrange.py
@@ -16,6 +16,9 @@
import dia
import math
+import gettext
+_ = gettext.gettext
+
def DeepCalc (dict, key, seen = None) :
# calculate all (deep) dependencies
# give a directory with component name as key and dependency components as list in dict[key][2]
@@ -121,6 +124,6 @@ def arrange_connected (data, flags) :
# fine due to Pythoninitializing the module only once
#
# \ingroup PyDia
-dia.register_callback ("Arrange _Objects",
+dia.register_callback (_("Arrange _Objects"),
"<Display>/Objects/Arrange",
arrange_connected)
diff --git a/plug-ins/python/autolayoutforce.py b/plug-ins/python/autolayoutforce.py
index ad2db8ae..65e2c189 100644
--- a/plug-ins/python/autolayoutforce.py
+++ b/plug-ins/python/autolayoutforce.py
@@ -22,6 +22,9 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import math, dia
+import gettext
+_ = gettext.gettext
+
def bbox_area (o) :
r = o.bounding_box
return (r.bottom - r.top) * (r.right - r.left)
@@ -41,7 +44,7 @@ def repulsion (rconst, node, other) :
m2 = bbox_area (other)
m1 = bbox_area (node)
-
+
dx = p1.x - p2.x
dy = p1.y - p2.y
@@ -56,7 +59,7 @@ def repulsion (rconst, node, other) :
return (0,0)
return (fx,fy)
-
+
def layout_force (nodes, rconst, aconst, timestep, damping) :
energy = [0.0, 0.0]
for o in nodes :
@@ -98,7 +101,7 @@ def layout_force (nodes, rconst, aconst, timestep, damping) :
def layout_force_cb (data, flags) :
diagram = dia.active_display().diagram
- # the things (nodes) we are moving around are all connected 'elements',
+ # the things (nodes) we are moving around are all connected 'elements',
# connection objects are only moving as a side effect
nodes = []
for o in data.selected :
@@ -120,6 +123,6 @@ def layout_force_cb (data, flags) :
diagram.flush()
print n, "iterations"
-dia.register_action ("LayoutForcePy", "_Layout (force)",
+dia.register_action ("LayoutForcePy", _("_Layout (force)"),
"/DisplayMenu/Test/TestExtensionStart",
layout_force_cb)
diff --git a/plug-ins/python/bbox.py b/plug-ins/python/bbox.py
index 65fd1f9e..8479d9f4 100644
--- a/plug-ins/python/bbox.py
+++ b/plug-ins/python/bbox.py
@@ -1,6 +1,6 @@
# Copyright (c) 2006, Hans Breuer <hans breuer org>
#
-# Draws bounding boxes of the objects in the active layer
+# Draws bounding boxes of the objects in the active layer
# into a new layer. Helps analyzing the font size problems
#
# This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,9 @@
import sys, dia, string
+import gettext
+_ = gettext.gettext
+
def bbox_cb (data, flags) :
layer = data.active_layer
@@ -43,7 +46,7 @@ def annotate_cb (data, flags) :
for o in layer.objects :
bb = o.bounding_box
a, h1, h2 = ann_type.create (bb.right, bb.top)
-
+
a.properties["text"] = "h: %g w: %g" % (bb.bottom - bb.top, bb.right - bb.left)
dest.add_object (a)
diff --git a/plug-ins/python/codegen.py b/plug-ins/python/codegen.py
index 1a96f90e..86ebe414 100644
--- a/plug-ins/python/codegen.py
+++ b/plug-ins/python/codegen.py
@@ -17,10 +17,13 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
class Klass :
def __init__ (self, name) :
self.name = name
- # use a list to preserve the order
+ # use a list to preserve the order
self.attributes = []
# a list, as java/c++ support multiple methods with the same name
self.operations = []
@@ -91,7 +94,7 @@ class ObjRenderer :
pass
# other UML objects which may be interesting
# UML - Note, UML - LargePackage, UML - SmallPackage, UML - Dependency, ...
-
+
edges = {}
for layer in data.layers :
for o in layer.objects :
@@ -113,7 +116,7 @@ class ObjRenderer :
if n.type.name == "UML - Generalization":
self.klasses[chi_name].AddParrent(par_name)
else: self.klasses[chi_name].AddTemplate(par_name)
-
+
def end_render(self) :
# without this we would accumulate info from every pass
self.attributes = []
@@ -121,7 +124,7 @@ class ObjRenderer :
##
# \brief Generate a Python source file from an UML class diagram
-class PyRenderer(ObjRenderer) :
+class PyRenderer(ObjRenderer) :
def __init__(self) :
ObjRenderer.__init__(self)
def end_render(self) :
@@ -176,7 +179,7 @@ class CxxRenderer(ObjRenderer) :
ops[v].append((t,so,p,i,c))
vars = [[], [], [], []]
for sa, (t, vi, va, vc, class_scope) in k.attributes :
- #TODO: use 'va'=value 'vc'=comment
+ #TODO: use 'va'=value 'vc'=comment
vars[vi].append((t, sa))
visibilities = ("public:", "private:", "protected:", "/* implementation: */")
for v in [0,2,1,3] :
@@ -201,7 +204,7 @@ class CxxRenderer(ObjRenderer) :
i = 0
m = len(op[2]) - 1
for p in op[2] :
- linefeed = ",\n\t" + " " * (n - 1)
+ linefeed = ",\n\t" + " " * (n - 1)
if i == m :
linefeed = ""
f.write ("%s %s%s" % (p[1], p[0], linefeed))
@@ -229,7 +232,7 @@ class CxxRenderer(ObjRenderer) :
# - Order of attributes and operations is preserved.
# - Auto generate type check.
#
-class JsRenderer(ObjRenderer) :
+class JsRenderer(ObjRenderer) :
def __init__(self) :
ObjRenderer.__init__(self)
def end_render(self) :
@@ -302,7 +305,7 @@ class JsRenderer(ObjRenderer) :
# 'Array[0..1233] of' is used. If the name uses a constant with
# "[MaxEntries]" an 'Array[0..MaxEntries-1] of' is written.
# - To inherit from classes which are not drawn (e.g. LCL/VCL classes),
-# name then class with the parent class in paranthesis (e.g.
+# name then class with the parent class in paranthesis (e.g.
# "TMainWin(TForm)"
#
# Features
@@ -488,7 +491,7 @@ class PascalRenderer(ObjRenderer) :
class JavaRenderer(ObjRenderer) :
def __init__(self) :
ObjRenderer.__init__(self)
-
+
def end_render(self) :
visibilities = {0:"public", 1:"private", 2:"protected"}
@@ -514,7 +517,7 @@ class JavaRenderer(ObjRenderer) :
if klass.templates:
f.write (" implements %s" % ", ".join(klass.templates))
f.write(" {\n")
-
+
# attributes
for attrname, (type, visibility, value, comment, class_scope) in klass.attributes :
if comment:
@@ -528,11 +531,11 @@ class JavaRenderer(ObjRenderer) :
f.write("\t%s%s %s" % (vis, type, attrname))
if value: f.write(" = %s" % value)
f.write(";\n")
-
+
# dafault constructor
if not klass.inheritance_type == "template":
f.write ("\n\tpublic %s() {\n\t\t\n\t}\n\n" % name)
-
+
# We should automatic implement abstract parrent and interface methods
parmethods = []
if klass.parents:
@@ -540,7 +543,7 @@ class JavaRenderer(ObjRenderer) :
self.klasses[klass.parents[0]].operations if m[3] == 0]
for template in klass.templates:
parmethods.extend(self.klasses[template].operations)
-
+
for pName, pMethod in parmethods:
pTypes = [p[1] for p in pMethod[2]]
for name, pars in [(n,m[2]) for n,m in klass.operations]:
@@ -548,7 +551,7 @@ class JavaRenderer(ObjRenderer) :
if pars == pMethod[2] and types == pTypes:
break
else: klass.operations.append((pName,pMethod))
-
+
for methodname, method in klass.operations :
# method comment
f.write("\t/**\n")
@@ -569,9 +572,9 @@ class JavaRenderer(ObjRenderer) :
v += 1
if value:
value = "=" + value
- pars.append((type, name, value))
+ pars.append((type, name, value))
pars = ", ".join([type+" "+name+value for type, name, value in pars])
-
+
vis = method[1] in visibilities and visibilities[method[1]] or ""
return_type = method[0] == "" and "void" or method[0]
inheritance_type = method[3] == 0 and "abstract " or ""
@@ -628,7 +631,7 @@ class PhpRenderer(ObjRenderer) :
if klass.templates:
f.write (" implements %s" % ", ".join(klass.templates))
f.write("\n{\n")
-
+
# attributes
for attrname, (type, visibility, value, comment, class_scope) in klass.attributes :
if comment:
@@ -651,7 +654,7 @@ class PhpRenderer(ObjRenderer) :
self.klasses[klass.parents[0]].operations if m[3] == 0]
for template in klass.templates:
parmethods.extend(self.klasses[template].operations)
-
+
for pName, pMethod in parmethods:
pTypes = [p[1] for p in pMethod[2]]
for name, pars in [(n,m[2]) for n,m in klass.operations]:
@@ -659,7 +662,7 @@ class PhpRenderer(ObjRenderer) :
if pars == pMethod[2] and types == pTypes:
break
else: klass.operations.append((pName,pMethod))
-
+
for methodname, method in klass.operations :
# method comment
f.write("\t/**\n")
@@ -682,7 +685,7 @@ class PhpRenderer(ObjRenderer) :
value = " = " + value
pars.append((type, '$' + name, value))
pars = ", ".join([type+" "+name+value for type, name, value in pars])
-
+
vis = method[1] in visibilities and visibilities[method[1]] or ""
return_type = method[0] == "" or method[0]
# TODO inheritance type is set to leaf/final by default in Dia. A normal type
is need for the default
@@ -701,13 +704,13 @@ class PhpRenderer(ObjRenderer) :
mainfile.close()
ObjRenderer.end_render(self)
- def draw_line(*args):pass
- def draw_string(*args):pass
+ def draw_line(self, *args):pass
+ def draw_string(self, *args):pass
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("PyDia Code Generation (Python)", "py", PyRenderer())
-dia.register_export ("PyDia Code Generation (C++)", "cxx", CxxRenderer())
-dia.register_export ("PyDia Code Generation (Pascal)", "pas", PascalRenderer())
-dia.register_export ("PyDia Code Generation (Java)", "java", JavaRenderer())
-dia.register_export ("PyDia Code Generation (JavaScript)", "js", JsRenderer())
-dia.register_export ("PyDia Code Generation (PHP)", "php", PhpRenderer())
+dia.register_export (_("PyDia Code Generation (Python)"), "py", PyRenderer())
+dia.register_export (_("PyDia Code Generation (C++)"), "cxx", CxxRenderer())
+dia.register_export (_("PyDia Code Generation (Pascal)"), "pas", PascalRenderer())
+dia.register_export (_("PyDia Code Generation (Java)"), "java", JavaRenderer())
+dia.register_export (_("PyDia Code Generation (JavaScript)"), "js", JsRenderer())
+dia.register_export (_("PyDia Code Generation (PHP)"), "php", PhpRenderer())
diff --git a/plug-ins/python/debug_objects.py b/plug-ins/python/debug_objects.py
index b4232b40..2948effe 100644
--- a/plug-ins/python/debug_objects.py
+++ b/plug-ins/python/debug_objects.py
@@ -1,5 +1,8 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
# sys.path.insert(0, 'd:/graph/dia/dia')
def dia_debug_cb (data, flags) :
@@ -24,10 +27,10 @@ def dia_debug_props_cb (data, flags) :
print "\t" + str(p)
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_action ("DebugBoundingbox", "Dia _BoundingBox Debugger",
+dia.register_action ("DebugBoundingbox", _("Dia _BoundingBox Debugger"),
"/DisplayMenu/Debug/DebugExtensionStart",
dia_debug_cb)
-dia.register_action ("DebugProperty", "Dia _Property API Debugger",
+dia.register_action ("DebugProperty", _("Dia _Property API Debugger"),
"/DisplayMenu/Debug/DebugExtensionStart",
dia_debug_props_cb)
diff --git a/plug-ins/python/dia_rotate.py b/plug-ins/python/dia_rotate.py
index 871b54fe..392604ac 100644
--- a/plug-ins/python/dia_rotate.py
+++ b/plug-ins/python/dia_rotate.py
@@ -1,4 +1,4 @@
-# PyDia Rotation
+# PyDia Rotation
# Copyright (c) 2003, Hans Breuer <hans breuer org>
# Copyright (c) 2009, 2011 Steffen Macke <sdteffen sdteffen de
#
@@ -18,6 +18,9 @@
import dia, math, string
+import gettext
+_ = gettext.gettext
+
class CRotateDialog :
def __init__(self, d, data) :
import pygtk
@@ -25,7 +28,7 @@ class CRotateDialog :
import gtk
win = gtk.Window()
win.connect("delete_event", self.on_delete)
- win.set_title("Rotate counter-clockwise")
+ win.set_title(_("Rotate counter-clockwise"))
self.diagram = d
self.data = data
@@ -41,7 +44,7 @@ class CRotateDialog :
box2.show()
label1 = gtk.Label()
- label1.set_text('Rotation around (0,0). Rotation angle in degrees:')
+ label1.set_text(_('Rotation around (0,0). Rotation angle in degrees:'))
box2.pack_start(label1)
label1.show()
@@ -95,7 +98,7 @@ def SimpleRotate(data, angle) :
scaleFailed = {}
ptype = dia.get_object_type('Standard - Polygon')
for o in objs :
- if o.type.name == 'Standard - Box' :
+ if o.type.name == 'Standard - Box' :
r = o.properties['obj_bb'].value
p = ptype.create(0,0)
p = p[0]
@@ -113,13 +116,13 @@ def SimpleRotate(data, angle) :
x = math.cos(angle_rad)*(h.pos.x+xm)-math.sin(angle_rad)*(h.pos.y+ym)
y = math.sin(angle_rad)*(h.pos.x+xm)+math.cos(angle_rad)*(h.pos.y)
o.move_handle(h, (x,y), 0, 0)
-
+
data.update_extents ()
dia.active_display().add_update_all()
def rotate_cb(data, flags) :
dlg = CRotateDialog(dia.active_display().diagram, data)
-dia.register_action ("ObjectsSimplerotation", "Simple _Rotation",
+dia.register_action ("ObjectsSimplerotation", _("Simple _Rotation"),
"/DisplayMenu/Objects/ObjectsExtensionStart",
rotate_cb)
diff --git a/plug-ins/python/diadissect.py b/plug-ins/python/diadissect.py
index 23ee70ae..abbca6be 100644
--- a/plug-ins/python/diadissect.py
+++ b/plug-ins/python/diadissect.py
@@ -20,6 +20,9 @@
import sys, string, dia
+import gettext
+_ = gettext.gettext
+
##
# \brief A dissecting renderer for Dia
#
@@ -161,4 +164,4 @@ class DissectRenderer :
self.Warning ("draw_image height too small")
# XXX: check image, e.g. existing file name
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("Dissect", "dissect", DissectRenderer())
+dia.register_export (_("Dissect"), "dissect", DissectRenderer())
diff --git a/plug-ins/python/diagx.py b/plug-ins/python/diagx.py
index 72f7dc72..93e4ccff 100644
--- a/plug-ins/python/diagx.py
+++ b/plug-ins/python/diagx.py
@@ -2,7 +2,7 @@
# Copyright (c) 2006 Hans Breuer <hans breuer org>
# Another attempt to import C++ into a diagram. This time it is not trying to parse C++ directly
-# but the XML generated by GCC_XML ( http://www.gccxml.org/ ).
+# but the XML generated by GCC_XML ( http://www.gccxml.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
@@ -20,6 +20,9 @@
import string, sys
+import gettext
+_ = gettext.gettext
+
class Node :
def __init__ (self, name) :
self.name = name
@@ -105,7 +108,7 @@ class Function(Node) :
args.append (":" + p.Name())
except :
print "E:", p, p.name, p.type
- if self.returns :
+ if self.returns :
ret = g_nodes[self.returns].Name() + " "
return ret + self.name + " (" + string.join(args, ", ") + ")"
@@ -163,7 +166,7 @@ class Klass(Node) :
if g_nodes[id].IsMethod() :
print "\t" + g_nodes[id].Signature()
elif g_nodes[id].IsUnion() :
- print "\t" + g_nodes[id].Name()
+ print "\t" + g_nodes[id].Name()
else :
try :
print "\t" + g_nodes[id].Name() + ":" +
g_nodes[g_nodes[id].type].Name()
@@ -180,7 +183,7 @@ class Namespace(Node) :
return g_nodes[id].Name() + "::" + self.name
else :
return self.name
-
+
g_nodes = {}
g_classes = []
@@ -225,7 +228,7 @@ def Parse (sFile, nodes) :
if "Constructor" == name : o = Method (attrs["name"], None)
elif "Destructor" == name : o = Method ("~" + attrs["name"], None)
else : o = Method (attrs["name"], attrs["returns"])
-
+
if attrs.has_key("virtual") : o.virtual += string.atoi(attrs["virtual"])
if attrs.has_key("pure_virtual") : o.virtual += string.atoi(attrs["pure_virtual"])
if attrs.has_key("access") : o.access = attrs["access"]
@@ -255,7 +258,7 @@ def Parse (sFile, nodes) :
o = Argument ("", "...")
if ctx[-1][1] :
ctx[-1][1].AddArg (o)
- o = None # lookup not possible
+ o = None # lookup not possible
elif "EnumValue" == name :
if ctx[-1][1] :
ctx[-1][1].AddName (attrs["name"])
@@ -263,7 +266,7 @@ def Parse (sFile, nodes) :
if attrs.has_key("name") :
o = Function (attrs["returns"], attrs["name"])
else : # function & type
- o = Function (attrs["returns"], attrs["id"])
+ o = Function (attrs["returns"], attrs["id"])
elif "Variable" == name :
pass # not ofinterest?
elif "File" == name :
@@ -276,7 +279,7 @@ def Parse (sFile, nodes) :
o.context = attrs["context"]
nodes[attrs["id"]] = o
ctx.append((name, o)) #push
-
+
def end_element(name) :
del ctx[-1] # pop
def char_data(data) :
@@ -307,7 +310,7 @@ def ImportXml (sFile, diagramData) :
Process (sFile)
# internal representation to diagram
layer = diagramData.active_layer
- # we need some kind of filter to not always generate the whole stl diagram
+ # we need some kind of filter to not always generate the whole stl diagram
theLinks = {}
nTotal = 0
for c in g_classes :
@@ -366,10 +369,10 @@ def ImportXml (sFile, diagramData) :
attributes.append ((m.Name().encode("UTF-8"),
m.Type().encode("UTF-8"), "", "", m.Visibility(),0,m.static))
except :
print "Error", m.name
- # set some properties
+ # set some properties
o.properties["operations"] = methods
o.properties["attributes"] = attributes
-
+
theObjects[s] = o
# class connections
for s in theLinks.keys() :
@@ -382,11 +385,11 @@ def ImportXml (sFile, diagramData) :
h1.connect (o2.connections[6])
h2.connect (o1.connections[1])
# update placement depending on number of parents ?
-
+
layer.update_extents()
#dia.active_display().add_update_all()
-
-if __name__ == '__main__':
+
+if __name__ == '__main__':
Process(sys.argv[1])
for c in g_classes :
if c.Name()[:2] != "__" and c.Name()[:5] != "std::" :
@@ -399,6 +402,6 @@ else :
try :
import dia
#dia.register_import("Cpp via GCC_XML", "cpp", ImportCpp)
- dia.register_import("XML from GCC_XML", "xml", ImportXml)
+ dia.register_import(_("XML from GCC_XML"), "xml", ImportXml)
except ImportError :
pass
diff --git a/plug-ins/python/diastddia.py b/plug-ins/python/diastddia.py
index a206dc47..e04b8e4e 100644
--- a/plug-ins/python/diastddia.py
+++ b/plug-ins/python/diastddia.py
@@ -20,6 +20,9 @@
import sys, string, os, math, dia
+import gettext
+_ = gettext.gettext
+
class StandardDiaRenderer :
def __init__ (self) :
self.f = None
@@ -138,7 +141,7 @@ class StandardDiaRenderer :
def set_font (self, font, size) :
self.font = font
self.font_size = size
- # now to the actual object creation - it should be 'delayed' to fold draw&fill again,
+ # now to the actual object creation - it should be 'delayed' to fold draw&fill again,
# split in the rendering process but the Dia's 'Standard' objects can do both in one
def _box (self, rect, color, fill) :
self.oid = self.oid + 1
@@ -154,7 +157,7 @@ class StandardDiaRenderer :
<dia:real val="%.3f"/>
</dia:attribute>
%s%s
- </dia:object>''' % (self.oid, rect.left,rect.top, rect.right - rect.left, rect.bottom - rect.top,
+ </dia:object>''' % (self.oid, rect.left,rect.top, rect.right - rect.left, rect.bottom - rect.top,
self._tinting(color, fill, 'border_color', 'border_width'), self._stroke_style()))
def draw_rect (self, rect, fill, stroke) :
if fill :
@@ -176,7 +179,7 @@ class StandardDiaRenderer :
<dia:real val="%.3f"/>
</dia:attribute>
%s%s
- </dia:object>''' % (self.oid, center.x-width/2, center.y-height/2, width, height,
+ </dia:object>''' % (self.oid, center.x-width/2, center.y-height/2, width, height,
self._tinting(color, fill, 'border_color', 'border_width'), self._stroke_style()))
def draw_ellipse (self, center, width, height, fill, stroke) :
if fill :
@@ -223,7 +226,7 @@ class StandardDiaRenderer :
self.f.write('''
<dia:object type="Standard - %s" version="0" id="O%d">
%s%s
- <dia:attribute name="poly_points">''' % (type_name, self.oid,
+ <dia:attribute name="poly_points">''' % (type_name, self.oid,
self._tinting(color, fill), self._stroke_style()))
for p in points :
self.f.write('''
@@ -303,7 +306,7 @@ class StandardDiaRenderer :
<dia:attribute name="valign">
<dia:enum val="3"/>
</dia:attribute>
- </dia:object>''' % (self.oid, pos.x, pos.y, text.replace("&", "&").replace(">",
">").replace("<", "<"),
+ </dia:object>''' % (self.oid, pos.x, pos.y, text.replace("&", "&").replace(">",
">").replace("<", "<"),
self.font.family, self.font.style, self.font_size,
self._rgb(color), alignment))
def draw_image (self, point, width, height, image) :
@@ -351,9 +354,9 @@ class StandardDiaRenderer :
<dia:point val="%.3f,%.3f"/>
</dia:attribute>
%s%s
- </dia:object>''' % (self.oid, start.x,start.y, end.x, end.y,
+ </dia:object>''' % (self.oid, start.x,start.y, end.x, end.y,
self._tinting(color), self._stroke_style()))
-
+
# register the renderer
-dia.register_export ("Dia plain", "dia", StandardDiaRenderer())
+dia.register_export (_("Dia plain"), "dia", StandardDiaRenderer())
diff --git a/plug-ins/python/diasvg.py b/plug-ins/python/diasvg.py
index f8a3382c..99ac4b43 100644
--- a/plug-ins/python/diasvg.py
+++ b/plug-ins/python/diasvg.py
@@ -18,6 +18,9 @@
import sys, string, dia
+import gettext
+_ = gettext.gettext
+
##
# \brief The second SvgRenderer implementation for Dia
#
@@ -146,7 +149,7 @@ class SvgRenderer :
% (self._rgb(color), self.line_width, self._stroke_style()))
else :
self.f.write('<path stroke="none" fill="%s"' % (self._rgb(color)))
- # moveto sx,sy arc rx,ry x-axis-rotation large-arc-flag,sweep-flag ex,ey
+ # moveto sx,sy arc rx,ry x-axis-rotation large-arc-flag,sweep-flag ex,ey
self.f.write(' d ="M %.3f,%.3f A %.3f,%.3f 0 %d,%d %.3f,%.3f ' % (sx, sy, rx, ry, largearc,
sweep, ex, ey))
self.f.write('"/>\n')
def draw_arc (self, center, width, height, angle1, angle2, color) :
@@ -188,7 +191,7 @@ class SvgRenderer :
self.f.write('z"/>\n')
def draw_string (self, text, pos, alignment, color) :
if len(text) < 1 :
- return # shouldn'this be done at the higher level
+ return # shouldn'this be done at the higher level
talign = ('start', 'middle', 'end') [alignment]
fstyle = ('normal', 'italic', 'oblique') [self.font.style & 0x03]
fweight = (400, 200, 300, 500, 600, 700, 800, 900) [(self.font.style >> 4) & 0x7]
@@ -261,5 +264,5 @@ class SvgzRenderer(SvgRenderer) :
self.f = gzip.open (name, "wb")
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("SVG plain", "svg", SvgRenderer())
-dia.register_export ("SVG compressed", "svgz", SvgzRenderer())
+dia.register_export (_("SVG plain"), "svg", SvgRenderer())
+dia.register_export (_("SVG compressed"), "svgz", SvgzRenderer())
diff --git a/plug-ins/python/diasvg_import.py b/plug-ins/python/diasvg_import.py
index a7065f1c..a9e364b8 100644
--- a/plug-ins/python/diasvg_import.py
+++ b/plug-ins/python/diasvg_import.py
@@ -2,12 +2,12 @@
# Copyright (c) 2003, 2004 Hans Breuer <hans breuer org>
#
# Pure Python Dia Import Filter - to show how it is done.
-# It also tries to be more featureful and robust then the
-# SVG importer written in C, but as long as PyDia has issues
+# It also tries to be more featureful and robust then the
+# SVG importer written in C, but as long as PyDia has issues
# this will _not_ be the case. Known issues (at least) :
# - xlink stuff (should probably have some StdProp equivalent)
# - lack of full transformation dealing
-# - real percentage scaling, is it worth it ?
+# - real percentage scaling, is it worth it ?
# - see FIXME in this file
# This program is free software; you can redistribute it and/or modify
@@ -26,14 +26,17 @@
import string, math, os, re
+import gettext
+_ = gettext.gettext
+
# Dias unit is cm, the default scale should be determined from svg:width and viewBox
dfPcm = 35.43307
dfUserScale = 1.0
dfFontSize = 0.7
-dfViewLength = 32.0 # wrong approach for "% unit"
+dfViewLength = 32.0 # wrong approach for "% unit"
dictUnitScales = {
"em" : 1.0, "ex" : 2.0, #FIXME these should be _relative_ to current font
- "px" : 1.0 / dfPcm, "pt" : 1.25 / dfPcm, "pc" : 15.0 / dfPcm,
+ "px" : 1.0 / dfPcm, "pt" : 1.25 / dfPcm, "pc" : 15.0 / dfPcm,
"cm" : 35.43307 / dfPcm, "mm" : 3.543307 / dfPcm, "in" : 90.0 / dfPcm}
# only compile once
@@ -125,14 +128,14 @@ class Object :
n = 0
if n == 0 : # should not really happen
self.props["line-style"] = (0, 1.0) # LINESTYLE_SOLID,
- elif n == 2 :
- if dlen > 0.1 : # FIXME:
+ elif n == 2 :
+ if dlen > 0.1 : # FIXME:
self.props["line-style"] = (1, dlen) # LINESTYLE_DASHED,
else :
self.props["line-style"] = (4, dlen) # LINESTYLE_DOTTED
- elif n == 4 :
+ elif n == 4 :
self.props["line-style"] = (2, dlen) # LINESTYLE_DASH_DOT,
- elif n == 6 :
+ elif n == 6 :
self.props["line-style"] = (3, dlen) # LINESTYLE_DASH_DOT_DOT,
def id(self, s) :
# just to handle/ignore it
@@ -171,7 +174,7 @@ class Object :
pass
else :
# Dia can't really display stroke none, some workaround :
- if self.props.has_key("fill") and self.props["fill"] != "none" :
+ if self.props.has_key("fill") and self.props["fill"] != "none" :
#does it really matter ?
try :
o.properties["line_colour"] = Color(self.props["fill"])
@@ -325,10 +328,10 @@ class Group(Object) :
for o in self.childs :
o.Dump(indent + 1)
-# One of my test files is quite ugly (produced by Batik) : it dumps identical image data
+# One of my test files is quite ugly (produced by Batik) : it dumps identical image data
# multiple times into the svg. This directory helps to reduce them to the necessary
# memory comsumption
-_imageData = {}
+_imageData = {}
class Image(Object) :
def __init__(self) :
@@ -364,7 +367,7 @@ class Image(Object) :
if self.props.has_key("width") :
o.properties["elem_height"] = self.props["height"]
if self.props.has_key("uri") :
- o.properties["image_file"] = self.props["uri"][8:]
+ o.properties["image_file"] = self.props["uri"][8:]
class Line(Object) :
def __init__(self) :
Object.__init__(self)
@@ -412,7 +415,7 @@ class Path(Object) :
sp = rPathValue.split(spd[i])
if sp[0] == "" : k = 1
for j in range(k, len(sp)-k-1, 6) :
- self.pts.append((2, Scaled(sp[j]), Scaled(sp[j+1]),
+ self.pts.append((2, Scaled(sp[j]), Scaled(sp[j+1]),
Scaled(sp[j+2]), Scaled(sp[j+3]),
Scaled(sp[j+4]), Scaled(sp[j+5])))
# reflexion second control to current point, really ?
@@ -450,10 +453,10 @@ class Rect(Object) :
def __init__(self) :
Object.__init__(self)
self.dt = "Standard - Box"
- # "corner_radius",
+ # "corner_radius",
def ApplyProps(self,o) :
- o.properties["elem_width"] = self.props["width"]
- o.properties["elem_height"] = self.props["height"]
+ o.properties["elem_width"] = self.props["width"]
+ o.properties["elem_height"] = self.props["height"]
class Ellipse(Object) :
def __init__(self) :
Object.__init__(self)
@@ -475,7 +478,7 @@ class Ellipse(Object) :
self.props["ry"] = Scaled(s)
self.props["y"] = self.props["cy"] - self.props["ry"]
def ApplyProps(self,o) :
- o.properties["elem_width"] = 2.0 * self.props["rx"]
+ o.properties["elem_width"] = 2.0 * self.props["rx"]
o.properties["elem_height"] = 2.0 * self.props["ry"]
class Circle(Ellipse) :
def __init__(self) :
@@ -484,7 +487,7 @@ class Circle(Ellipse) :
Ellipse.rx(self,s)
Ellipse.ry(self,s)
class Poly(Object) :
- def __init__(self) :
+ def __init__(self) :
Object.__init__(self)
self.dt = None # abstract class !
def points(self,s) :
@@ -599,7 +602,7 @@ class Importer :
o = Group()
stack.append(o)
elif 'tspan' == name :
- #FIXME: to take all the style coming with it into account
+ #FIXME: to take all the style coming with it into account
# Dia would need to support layouted text ...
txn, txo = ctx[-1]
if attrs.has_key("dy") :
@@ -680,12 +683,12 @@ class Importer :
s = "To hide the error messages delete or disable the 'Errors' layer\n"
for e in self.errors.keys() :
s = s + str(e) + " -> " + str(self.errors[e]) + "\n"
-
+
o = Text()
o.props["fill"] = "red"
o.Set(s)
layer.add_object(o.Create())
- # create a 'Description' layer
+ # create a 'Description' layer
data.update_extents ()
return 1
def Dump(self) :
@@ -725,6 +728,6 @@ def import_svgz(sFile, diagramData) :
return imp.Render(diagramData)
import dia
-dia.register_import("SVG plain", "svg", import_svg)
-dia.register_import("SVG compressed", "svgz", import_svgz)
+dia.register_import(_("SVG plain"), "svg", import_svg)
+dia.register_import(_("SVG compressed"), "svgz", import_svgz)
diff --git a/plug-ins/python/dot.py b/plug-ins/python/dot.py
index 89c10832..2035deed 100644
--- a/plug-ins/python/dot.py
+++ b/plug-ins/python/dot.py
@@ -21,6 +21,9 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
class DotRenderer :
def __init__ (self) :
self.nodes = {}
@@ -71,7 +74,7 @@ class DotRenderer :
self.edges[str(n)] = 1
if not (n.handles[0].connected_to and
n.handles[1].connected_to) :
continue
- # the right handles give us the direction
+ # the right handles give us the direction
a = n.handles[0].connected_to.object
b = n.handles[1].connected_to.object
try :
@@ -84,6 +87,6 @@ class DotRenderer :
self.f.write('}\n')
def end_render (self) :
self.f.close()
-
+
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("PyDia DOT Export", "dot", DotRenderer())
+dia.register_export (_("PyDia DOT Export"), "dot", DotRenderer())
diff --git a/plug-ins/python/dot2dia.py b/plug-ins/python/dot2dia.py
index 7b4a8608..ee224f30 100644
--- a/plug-ins/python/dot2dia.py
+++ b/plug-ins/python/dot2dia.py
@@ -21,9 +21,12 @@
import re, string, sys
+import gettext
+_ = gettext.gettext
+
# FIXME: keywords are case indepentend
keywords = ['node', 'edge', 'graph', 'digraph', 'strict']
-# starts with either a keyword or a node name in quotes.
+# starts with either a keyword or a node name in quotes.
# BEWARE: (?<-> ) - negative lookbehind to not find nodes a second time in connection definition (and
misinterpret the params)
rDecl = re.compile(r'\s*(?<!-> )(?P<cmd>(?:' + string.join(keywords, ')|(?:') + ')|(?:\w+' +
')|(?:"[^"]+"))\s+\[(?P<dict>[^\]]+)\];', re.DOTALL | re.MULTILINE)
# dont assume that all node names are in quotes
@@ -129,7 +132,7 @@ class Edge(Object) :
print xy
continue
bp.append((x,y))
- # must convert to _one_ tuple
+ # must convert to _one_ tuple
if i == 0 : # first must be move to
pts.append ((0, bp[0][0], bp[0][1]))
bp = [] # reset to new point
@@ -142,7 +145,7 @@ class Edge(Object) :
diaobj.properties['bez_points'] = pts
else :
print "BezPoints", pts
-
+
def MergeParms (d, extra) :
for k in extra.keys() :
if not d.has_key(k) :
@@ -171,7 +174,7 @@ def Parse(sFile) :
else : # must be a node
n = Node(name, DictFromString(m.group("dict")))
if extra.has_key('node') :
- MergeParms(n.parms, extra['node'])
+ MergeParms(n.parms, extra['node'])
nodes[name] = n
for m in rEdge.finditer(s) :
if m :
@@ -191,7 +194,7 @@ def Parse(sFile) :
##
# \brief Adding a label for the edges
-#
+#
# This function could be improved if Dia would allow to
# attach labels to arbitrary objects. For the time being
# only the initial postion does match, but relayouting the
@@ -266,7 +269,7 @@ def ImportFile (sFile, diagramData) :
diagram.update_extents()
return diagramData
-if __name__ == '__main__':
+if __name__ == '__main__':
# just testing at the moment
nodes, edges = Parse(sys.argv[1])
for k, n in nodes.iteritems() :
@@ -276,4 +279,4 @@ if __name__ == '__main__':
else :
# run as a Dia plug-in
import dia
- dia.register_import ("Graphviz Dot", "dot", ImportFile)
+ dia.register_import (_("Graphviz Dot"), "dot", ImportFile)
diff --git a/plug-ins/python/doxrev.py b/plug-ins/python/doxrev.py
index b5992cf1..5dc243f0 100644
--- a/plug-ins/python/doxrev.py
+++ b/plug-ins/python/doxrev.py
@@ -23,14 +23,14 @@
#
# - actually call doxygen to make the xml
# - for directories, additional INCLUDE, etc. with GUI
-# - delete temporary files or better make doxgen output them on stdout?
+# - delete temporary files or better make doxgen output them on stdout?
# - have a way in the plug-in interface to import multiple files at once?
# - another way could be to let doxygen put everything in one file?
#
# - for single class import connect by searching base classes in the diagram
#
# - some layout algorithm based on inheritance
-# - maybe this should be done as an extra script/plug-in becasue it could be
+# - maybe this should be done as an extra script/plug-in becasue it could be
# useful on already existing diagrams as well
# - some smart way to handle size change with 'visible comments', maybe
# also tweaking wtih wrap-after-char
@@ -38,6 +38,9 @@
import glob, os, string
+import gettext
+_ = gettext.gettext
+
# debug spew
g_verbose = 0
@@ -50,7 +53,7 @@ class Element :
self.props = {}
self.attrs = None
def __str__ (self) :
- return "<" + self.__class__.__name__ + ">" + self.kind + ":" + self.name
+ return "<" + self.__class__.__name__ + ">" + self.kind + ":" + self.name
def Set (self, key, value) :
if key in ["compoundname", "name", "declname", "array"] :
if len(self.name) == 0 :
@@ -132,7 +135,7 @@ class Compounddef(Element) :
comment = ""
for p in m.parameters :
# FIXME: wrong list, there are no parameters on an attribute
- comment += p.text
+ comment += p.text
attributes.append ((m.name, m.type, value, comment, visibility, 0,
m.IsStatic()))
return attributes
def GetMethods (self) :
@@ -142,7 +145,7 @@ class Compounddef(Element) :
if not v.__class__.__name__ in ["Briefdescription", "Detaileddescription",
"Listofallmembers"] :
print "***", v.__class__.__name__
continue
- visibility = v.GetVisibility()
+ visibility = v.GetVisibility()
if visibility is None :
continue # friend does not belong here
inheritance_type = 0 # (abstract, virtual, final)
@@ -162,7 +165,7 @@ class Compounddef(Element) :
if m.GetVisibility () :
visibility = m.GetVisibility()
# (name, type, comment, stereotype, visibility, inheritance_type, query,
class_scope, params)
- methods.append ((m.name, m.type, comment, "", visibility,
+ methods.append ((m.name, m.type, comment, "", visibility,
m.GetInheritanceType(), m.IsQuery(), m.IsStatic(), params))
return methods
def IsAbstract (self) :
@@ -194,8 +197,8 @@ class Sectiondef(Element) :
class Memberdef(Element) :
def __init__ (self, kind) :
Element.__init__(self)
- if kind in ["enum"] :
- self.type = kind
+ if kind in ["enum"] :
+ self.type = kind
self.kind = kind
self.parameters = []
def Add (self, o) :
@@ -236,7 +239,7 @@ class Memberdef(Element) :
if self.attrs["const"] != "no" :
return 1
return 0
-
+
class Enumvalue(Element) :
def __init__ (self) :
Element.__init__(self)
@@ -435,7 +438,7 @@ if __name__ == '__main__':
print o.GetAttributes()
else :
import dia
-
+
def import_classes (classes, diagramData) :
class_map = {}
layer = diagramData.active_layer
@@ -444,7 +447,7 @@ else :
o, h1, h2 = dia.get_object_type("UML - Class").create(0,0)
# origin and dia object mapped by id
class_map[c.id] = (c, o)
- # set some properties
+ # set some properties
o.properties["name"] = str(c.name)
o.properties["abstract"] = c.IsAbstract ()
try :
@@ -467,7 +470,7 @@ else :
h1.connect (p.connections[6])
h2.connect (o.connections[1])
# ... and move appropriately
-
+
# update placement depending on number of parents ?
layer.update_extents()
@@ -482,6 +485,6 @@ else :
classes = GetClasses ([sFile])
return import_classes (classes, diagramData)
- dia.register_import("Dox2UML", "xml", import_file)
- dia.register_import("Dox2UML (multiple)", "xml", import_files)
+ dia.register_import(_("Dox2UML"), "xml", import_file)
+ dia.register_import(_("Dox2UML (multiple)"), "xml", import_files)
#dia.register_import("Dox2UML", "h", import_headers)
diff --git a/plug-ins/python/export-object.py b/plug-ins/python/export-object.py
index 3e3d1ba9..07dd9844 100644
--- a/plug-ins/python/export-object.py
+++ b/plug-ins/python/export-object.py
@@ -1,5 +1,8 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
# sys.path.insert(0, 'd:/graph/dia/dia')
class ObjRenderer :
@@ -39,4 +42,4 @@ class ObjRenderer :
self.f.close()
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("PyDia Object Export", "diapyo", ObjRenderer())
+dia.register_export (_("PyDia Object Export"), "diapyo", ObjRenderer())
diff --git a/plug-ins/python/export-render.py b/plug-ins/python/export-render.py
index e09a5919..863134e7 100644
--- a/plug-ins/python/export-render.py
+++ b/plug-ins/python/export-render.py
@@ -1,5 +1,8 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
# sys.path.insert(0, 'd:/graph/dia/dia')
##
@@ -113,4 +116,4 @@ class DumpRenderer :
## \brief Register the renderer with Dia's export system
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("PyDia Render Export", "diapyr", DumpRenderer())
+dia.register_export (_("PyDia Render Export"), "diapyr", DumpRenderer())
diff --git a/plug-ins/python/group_props.py b/plug-ins/python/group_props.py
index de2ef41d..e847ee7e 100644
--- a/plug-ins/python/group_props.py
+++ b/plug-ins/python/group_props.py
@@ -27,6 +27,9 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
class CPropsDialog :
def __init__(self, diagram, data, props) :
import pygtk
@@ -39,7 +42,7 @@ class CPropsDialog :
self.win = gtk.Window ()
self.win.connect("delete_event", self.on_delete)
- self.win.set_title("Group Properties")
+ self.win.set_title(_("Group Properties"))
box1 = gtk.VBox()
self.win.add(box1)
@@ -59,8 +62,8 @@ class CPropsDialog :
table.set_row_spacings(2)
table.set_col_spacings(5)
table.set_border_width(5)
+ y = 0
if len(props) :
- y = 0
for s in props.keys() :
w = gtk.CheckButton(s)
self.checkboxes.append(w)
@@ -82,7 +85,7 @@ class CPropsDialog :
w.show()
y = y + 1
else :
- w = gtk.Label("The selected objects don't share any\n properties to change at once.")
+ w = gtk.Label(_("The selected objects don't share any\n properties to change at
once."))
table.attach(w, 0, 1, y, y+1)
w.show()
box2.pack_start(table)
@@ -177,6 +180,6 @@ def dia_objects_props_cb (data, flags) :
except ImportError :
dia.message(0, "Dialog creation failed. Missing pygtk?")
-dia.register_action ("DialogsGroupproperties", "Dia _Group Properties",
+dia.register_action ("DialogsGroupproperties", _("Dia _Group Properties"),
"/DisplayMenu/Dialogs/DialogsExtensionStart",
dia_objects_props_cb)
diff --git a/plug-ins/python/gtkcons.py b/plug-ins/python/gtkcons.py
index 80edd21f..9ab07053 100755
--- a/plug-ins/python/gtkcons.py
+++ b/plug-ins/python/gtkcons.py
@@ -37,6 +37,9 @@ import gtk
import gtk.keysyms
import gobject
+import gettext
+_ = gettext.gettext
+
stdout = sys.stdout
if not hasattr(sys, 'ps1'): sys.ps1 = '>>> '
@@ -131,12 +134,11 @@ class Console(gtk.VBox):
self.command = buffer.create_tag('command')
self.command.set_property("family", "Sans")
self.command.set_property("foreground", "blue")
-
+
vadj = gtk.Adjustment()
hadj = gtk.Adjustment()
self.text.set_scroll_adjustments (hadj, vadj)
self.vscroll = gtk.VScrollbar(vadj)
- self.vscroll.set_update_policy(gtk.POLICY_AUTOMATIC)
self.inp.pack_end(self.vscroll, expand=False)
self.vscroll.show()
@@ -251,7 +253,7 @@ class Console(gtk.VBox):
self.history[self.histpos] = l
self.histpos = self.histpos - 1
self.line.set_text(self.history[self.histpos])
-
+
def historyDown(self):
if self.histpos < len(self.history) - 1:
l = self.line.get_text()
@@ -339,9 +341,9 @@ try :
import dia
def open_console(data, flags):
gtk_console({'__builtins__': __builtins__, '__name__': '__main__',
- '__doc__': None, 'dia': dia}, 'Python Dia Console')
+ '__doc__': None, 'dia': dia}, _('Python Dia Console'))
- dia.register_action ("DialogsPythonconsole", "_Python Console",
+ dia.register_action ("DialogsPythonconsole", _("_Python Console"),
"/DisplayMenu/Dialogs/DialogsExtensionStart",
open_console)
diff --git a/plug-ins/python/imgmap.py b/plug-ins/python/imgmap.py
index 70f8ca47..316b7e97 100644
--- a/plug-ins/python/imgmap.py
+++ b/plug-ins/python/imgmap.py
@@ -1,4 +1,4 @@
-# PyDia imgmap.py : produce an html image map
+# PyDia imgmap.py : produce an html image map
# Copyright (c) 2007 Hans Breuer <hans breuer org>
# This program is free software; you can redistribute it and/or modify
@@ -17,6 +17,9 @@
import dia, sys, os.path, string
+import gettext
+_ = gettext.gettext
+
class ObjRenderer :
def __init__ (self) :
self.f = None
@@ -38,7 +41,7 @@ class ObjRenderer :
fname = name[:string.find(name, ".")] + ".png" # guessing
self.f.write ('<image src="%s" width="%d", height="%d" usemap="#%s">\n' % (fname, width,
height, name))
self.f.write ('<map name="%s">\n' % (name,))
-
+
self.xofs = - (r.left * scale)
self.yofs = - (r.top * scale)
if bMapLayer :
@@ -74,4 +77,4 @@ class ObjRenderer :
self.f.close()
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("Imagemap", "cmap", ObjRenderer())
+dia.register_export (_("Imagemap"), "cmap", ObjRenderer())
diff --git a/plug-ins/python/mark-cps.py b/plug-ins/python/mark-cps.py
index 8da280a0..4a65ce82 100644
--- a/plug-ins/python/mark-cps.py
+++ b/plug-ins/python/mark-cps.py
@@ -18,6 +18,9 @@
import dia
+import gettext
+_ = gettext.gettext
+
def mark_cps (data, flags) :
objs = data.get_sorted_selected()
layer = data.active_layer
@@ -66,5 +69,5 @@ def mark_cps (data, flags) :
adisp.diagram.flush()
-dia.register_action("DebugMarkConnectionPoints", "_Mark Connection Points",
+dia.register_action("DebugMarkConnectionPoints", _("_Mark Connection Points"),
"/DisplayMenu/Debug/DebugExtensionStart", mark_cps)
diff --git a/plug-ins/python/otypes.py b/plug-ins/python/otypes.py
index 4a05eb0a..ee51c1fd 100644
--- a/plug-ins/python/otypes.py
+++ b/plug-ins/python/otypes.py
@@ -21,6 +21,9 @@
import sys, dia, string
+import gettext
+_ = gettext.gettext
+
def _log(s, append=1) :
pass
if append :
@@ -68,7 +71,7 @@ def otypes_cb(data, flags) :
if packages.has_key(sp) :
packages[sp].append(st)
else :
- packages[sp] = [st]
+ packages[sp] = [st]
dtp = dia.get_object_type("UML - LargePackage")
dtc = dia.get_object_type("UML - Class")
@@ -118,19 +121,19 @@ def otypes_cb(data, flags) :
if n_line == len(line_props) :
formal_params.append(('Line', ''))
else : # need to add the incomplete set
- for pp in line_props :
+ for pp in line_props :
if o_real.properties.has_key(pp) :
attrs.append((pp, o_real.properties[pp].type, '', '',
0, 0, 0))
if n_fill == len(fill_props) :
formal_params.append(('Fill', ''))
else :
- for pp in fill_props :
+ for pp in fill_props :
if o_real.properties.has_key(pp) :
attrs.append((pp, o_real.properties[pp].type, '', '',
0, 0, 0))
if n_text == len(text_props) :
formal_params.append(('Text', ''))
else :
- for pp in text_props :
+ for pp in text_props :
if o_real.properties.has_key(pp) :
attrs.append((pp, o_real.properties[pp].type, '', '',
0, 0, 0))
if n_orthconn == len(orthconn_props) :
@@ -153,7 +156,7 @@ def otypes_cb(data, flags) :
oc.properties["templates"] = formal_params
layer.add_object(oc)
# XXX: there really should be a way to safely delete an object. This one will crash:
- # - when the object got added somewhere
+ # - when the object got added somewhere
# - any object method gets called afterwards
if not o_real is None :
o_real.destroy()
@@ -179,6 +182,6 @@ def otypes_cb(data, flags) :
# make it work standalone
return data
-dia.register_action ("HelpOtypes", "Dia Object _Types",
+dia.register_action ("HelpOtypes", _("Dia Object _Types"),
"/ToolboxMenu/Help/HelpExtensionStart",
otypes_cb)
diff --git a/plug-ins/python/pydiadoc.py b/plug-ins/python/pydiadoc.py
index ea11072d..bff71fdc 100644
--- a/plug-ins/python/pydiadoc.py
+++ b/plug-ins/python/pydiadoc.py
@@ -22,6 +22,9 @@
import sys, math, dia, types, string
+import gettext
+_ = gettext.gettext
+
def distribute_objects (objs) :
width = 0.0
height = 0.0
@@ -258,12 +261,12 @@ def autodoc_html_cb (data, flags) :
dia.message(0, path + os.path.sep + "dia.html saved.")
webbrowser.open('file://' + os.path.realpath(path + os.path.sep + "dia.html"))
-dia.register_action ("HelpPydia2", "PyDia _HTML Docs",
+dia.register_action ("HelpPydia2", _("PyDia _HTML Docs"),
"/ToolboxMenu/Help/HelpExtensionStart",
autodoc_html_cb)
-dia.register_action ("HelpPydia", "PyDia _Docs",
+dia.register_action ("HelpPydia", _("PyDia _Docs"),
"/ToolboxMenu/Help/HelpExtensionStart",
autodoc_fresh_cb)
-dia.register_action ("UpdatePydia", "PyDia Docs _Update",
+dia.register_action ("UpdatePydia", _("PyDia Docs _Update"),
"/DisplayMenu/Help/HelpExtensionStart",
autodoc_update_cb)
diff --git a/plug-ins/python/scascale.py b/plug-ins/python/scascale.py
index d1854448..2bc68c4f 100644
--- a/plug-ins/python/scascale.py
+++ b/plug-ins/python/scascale.py
@@ -25,6 +25,9 @@
import dia, string
+import gettext
+_ = gettext.gettext
+
class CScaleDialog :
def __init__(self, d, data) :
import pygtk
@@ -32,7 +35,7 @@ class CScaleDialog :
import gtk
win = gtk.Window()
win.connect("delete_event", self.on_delete)
- win.set_title("Simple Scaling")
+ win.set_title(_("Simple Scaling"))
self.diagram = d
self.data = data
@@ -61,7 +64,7 @@ class CScaleDialog :
box1.pack_start(box2, expand=0)
box2.show()
- button = gtk.Button("scale")
+ button = gtk.Button(_("Scale"))
button.connect("clicked", self.on_scale)
box2.pack_start(button)
button.set_flags(gtk.CAN_DEFAULT)
@@ -146,6 +149,6 @@ def SimpleScale(data, factor) :
def scale_cb(data, flags) :
dlg = CScaleDialog(dia.active_display().diagram, data)
-dia.register_action ("ObjectsSimplescaling", "Simple _Scaling",
+dia.register_action ("ObjectsSimplescaling", _("Simple _Scaling"),
"/DisplayMenu/Objects/ObjectsExtensionStart",
scale_cb)
diff --git a/plug-ins/python/select_by.py b/plug-ins/python/select_by.py
index 4afadeb6..f21d44d4 100644
--- a/plug-ins/python/select_by.py
+++ b/plug-ins/python/select_by.py
@@ -24,6 +24,9 @@
import sys, dia
+import gettext
+_ = gettext.gettext
+
class CFindDialog :
def __init__(self, d, data) :
import pygtk
@@ -32,7 +35,7 @@ class CFindDialog :
win = gtk.Window()
win.connect("delete_event", self.on_delete)
- win.set_title("Select by name")
+ win.set_title(_("Select by name"))
self.diagram = d
self.data = data
@@ -48,7 +51,7 @@ class CFindDialog :
box2.show()
self.entry = gtk.Entry()
- self.entry.set_text("enter name")
+ self.entry.set_text(_("Enter name"))
box2.pack_start(self.entry)
self.entry.show()
@@ -61,7 +64,7 @@ class CFindDialog :
box1.pack_start(box2, expand=0)
box2.show()
- button = gtk.Button("find")
+ button = gtk.Button(_("Find"))
button.connect("clicked", self.on_find)
box2.pack_start(button)
button.set_flags(gtk.CAN_DEFAULT)
@@ -140,18 +143,18 @@ def select_by_size_cb (data, flags) :
d.flush()
-dia.register_action ("SelectByName", "_Name",
+dia.register_action ("SelectByName", _("_Name"),
"/DisplayMenu/Select/SelectBy/SelectByExtensionStart",
select_by_name_cb)
-dia.register_action ("SelectByFillcolor", "_Fill Color",
+dia.register_action ("SelectByFillcolor", _("_Fill Color"),
"/DisplayMenu/Select/SelectBy/SelectByExtensionStart",
select_by_fill_color_cb)
-dia.register_action ("SelectByLinecolor", "_Line Color",
+dia.register_action ("SelectByLinecolor", _("_Line Color"),
"/DisplayMenu/Select/SelectBy/SelectByExtensionStart",
select_by_line_color_cb)
-dia.register_action ("SelectByTextcolor", "_Text Color",
+dia.register_action ("SelectByTextcolor", _("_Text Color"),
"/DisplayMenu/Select/SelectBy/SelectByExtensionStart",
select_by_text_color_cb)
-dia.register_action ("SelectBySize", "_Size",
+dia.register_action ("SelectBySize", _("_Size"),
"/DisplayMenu/Select/SelectBy/SelectByExtensionStart",
select_by_size_cb)
diff --git a/plug-ins/python/select_empty.py b/plug-ins/python/select_empty.py
index 87f02879..0b0b65b9 100644
--- a/plug-ins/python/select_empty.py
+++ b/plug-ins/python/select_empty.py
@@ -17,6 +17,9 @@
import dia
+import gettext
+_ = gettext.gettext
+
def select_empty_cb (data, flags) :
diagram = dia.active_display().diagram
objs = data.active_layer.objects
@@ -25,6 +28,6 @@ def select_empty_cb (data, flags) :
or o.bounding_box.top == o.bounding_box.bottom :
diagram.select (o)
-dia.register_action ("SelectEmpty", "_Empty",
+dia.register_action ("SelectEmpty", _("_Empty"),
"/DisplayMenu/Select/By/SelectByExtensionStart",
select_empty_cb)
diff --git a/plug-ins/python/uninline_data.py b/plug-ins/python/uninline_data.py
index 82b18347..0101ab99 100644
--- a/plug-ins/python/uninline_data.py
+++ b/plug-ins/python/uninline_data.py
@@ -18,6 +18,9 @@
import os, string, sys, dia
+import gettext
+_ = gettext.gettext
+
class UninlineRenderer :
def __init__ (self) :
self.count = 0
@@ -44,6 +47,6 @@ class UninlineRenderer :
def end_render (self) :
pass
-
+
# dia-python keeps a reference to the renderer class and uses it on demand
-dia.register_export ("Uninline Images", "png", UninlineRenderer())
+dia.register_export (_("Uninline Images"), "png", UninlineRenderer())
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a219a8e0..9cf1353a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -227,6 +227,35 @@ plug-ins/pstricks/pstricks.c
plug-ins/pstricks/render_pstricks.c
plug-ins/python/pydia-render.c
plug-ins/python/python.c
+plug-ins/python/allprops.py
+plug-ins/python/allsheets.py
+plug-ins/python/aobjects.py
+plug-ins/python/arrange.py
+plug-ins/python/autolayoutforce.py
+plug-ins/python/bbox.py
+plug-ins/python/codegen.py
+plug-ins/python/debug_objects.py
+plug-ins/python/dia_rotate.py
+plug-ins/python/diadissect.py
+plug-ins/python/diagx.py
+plug-ins/python/diastddia.py
+plug-ins/python/diasvg_import.py
+plug-ins/python/diasvg.py
+plug-ins/python/dot.py
+plug-ins/python/dot2dia.py
+plug-ins/python/doxrev.py
+plug-ins/python/export-object.py
+plug-ins/python/export-render.py
+plug-ins/python/group_props.py
+plug-ins/python/gtkcons.py
+plug-ins/python/imgmap.py
+plug-ins/python/mark-cps.py
+plug-ins/python/otypes.py
+plug-ins/python/pydiadoc.py
+plug-ins/python/scascale.py
+plug-ins/python/select_by.py
+plug-ins/python/select_empty.py
+plug-ins/python/uninline_data.py
plug-ins/shape/shape.c
plug-ins/shape/shape-export.c
plug-ins/svg/render_svg.c
@@ -282,3 +311,4 @@ sheets/SDL.sheet
sheets/Shape_Design.sheet
sheets/sybase.sheet
sheets/UML.sheet
+sheets/EDPC.sheet
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index caf82dcc..21596181 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,11 +1,5 @@
plug-ins/layout/ogdf-simple.cpp
plug-ins/layout/ogdf-simple.h
-plug-ins/python/otypes.py
-plug-ins/python/autolayoutforce.py
-plug-ins/python/gtkcons.py
-plug-ins/python/aobjects.py
-plug-ins/python/diasvg.py
-plug-ins/python/doxrev.py
plug-ins/stress/stress.c
plug-ins/stress/stress-memory.c
plug-ins/stress/stress-memory.h
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]