Hello community, here is the log from the commit of package kig for openSUSE:Factory checked in at 2012-01-30 12:25:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kig (Old) and /work/SRC/openSUSE:Factory/.kig.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kig", Maintainer is "kig" Changes: -------- --- /work/SRC/openSUSE:Factory/kig/kig.changes 2011-12-08 12:11:05.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kig.new/kig.changes 2012-01-30 12:25:33.000000000 +0100 @@ -1,0 +2,16 @@ +Wed Jan 18 20:58:22 CET 2012 - [email protected] + +- update to 4.8.0 + * first stable release of KDE 4.8 (only critical fixes over 4.7.98) + * see http://kde.org/announcements/4.8/ for details + + +------------------------------------------------------------------- +Tue Jan 10 16:33:05 CET 2012 - [email protected] + +- update to 4.7.98 + * RC2+ milestone release of KDE 4.8 + * see http://kde.org/announcements/4.8/ for details + + +------------------------------------------------------------------- Old: ---- kig-4.7.4.tar.bz2 New: ---- kig-4.8.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kig.spec ++++++ --- /var/tmp/diff_new_pack.c2gEX4/_old 2012-01-30 12:25:35.000000000 +0100 +++ /var/tmp/diff_new_pack.c2gEX4/_new 2012-01-30 12:25:35.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package kig # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -45,7 +45,7 @@ BuildRequires: ocaml BuildRequires: ocaml-facile %endif -Version: 4.7.4 +Version: 4.8.0 Release: 0 Summary: Interactive Geometry License: GPL-2.0+ ++++++ kig-4.7.4.tar.bz2 -> kig-4.8.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/CMakeLists.txt new/kig-4.8.0/CMakeLists.txt --- old/kig-4.7.4/CMakeLists.txt 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/CMakeLists.txt 2011-09-26 11:44:34.000000000 +0200 @@ -107,6 +107,7 @@ misc/equation.cc misc/goniometry.cc misc/guiaction.cc + misc/kigcoordinateprecisiondialog.cpp misc/kigfiledialog.cc misc/kiginputdialog.cc misc/kignumerics.cpp @@ -166,6 +167,7 @@ filters/imageexporteroptionswidget.ui filters/latexexporteroptionswidget.ui filters/svgexporteroptionswidget.ui + misc/kigcoordinateprecisiondialog.ui ) if(BOOST_PYTHON_FOUND) Files old/kig-4.7.4/doc/index.cache.bz2 and new/kig-4.8.0/doc/index.cache.bz2 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kig.desktop new/kig-4.8.0/kig/kig.desktop --- old/kig-4.7.4/kig/kig.desktop 2011-10-28 09:43:41.000000000 +0200 +++ new/kig-4.8.0/kig/kig.desktop 2012-01-10 15:15:10.000000000 +0100 @@ -85,7 +85,7 @@ GenericName[es]=Geometría interactiva GenericName[et]=Interaktiivne geomeetria GenericName[eu]=Geometria interaktiboa -GenericName[fa]=هندسۀ تعاملی +GenericName[fa]=هندسه تعاملی GenericName[fi]=Vuorovaikutteinen geometria GenericName[fr]=Géométrie interactive GenericName[ga]=Céimseata Idirghníomhach diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kig_document.cc new/kig-4.8.0/kig/kig_document.cc --- old/kig-4.7.4/kig/kig_document.cc 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/kig/kig_document.cc 2011-09-26 11:44:34.000000000 +0200 @@ -17,6 +17,7 @@ #include "kig_document.h" +#include "../misc/common.h" #include "../objects/object_calcer.h" #include "../objects/object_holder.h" #include "../objects/point_imp.h" @@ -27,11 +28,12 @@ #include <assert.h> #include <iterator> +#include <cmath> KigDocument::KigDocument( std::set<ObjectHolder*> objects, CoordinateSystem* coordsystem, bool showgrid, bool showaxes, bool nv ) : mobjects( objects ), mcoordsystem( coordsystem ), mshowgrid( showgrid ), - mshowaxes( showaxes ), mnightvision( nv ), mcachedparam( 0.0 ) + mshowaxes( showaxes ), mnightvision( nv ), mcachedparam( 0.0 ), coordinatePrecision( -1 ) { } @@ -164,6 +166,7 @@ mshowgrid = true; mshowaxes = true; mnightvision = false; + coordinatePrecision = -1; } KigDocument::~KigDocument() @@ -195,6 +198,11 @@ mnightvision = nv; } +void KigDocument::setCoordinatePrecision( int precision ) +{ + coordinatePrecision = precision; +} + bool KigDocument::axes() const { return mshowaxes; @@ -205,6 +213,25 @@ return mnightvision; } +bool KigDocument::isUserSpecifiedCoordinatePrecision() const +{ + return coordinatePrecision != -1; +} + +int KigDocument::getCoordinatePrecision() const +{ + if( coordinatePrecision == -1 ) + { + // we use default coordinate precision calculation + Rect sr = suggestedRect(); + double m = kigMax( sr.width(), sr.height() ); + + return kigMax( 0, (int) ( 3 - log10( m ) ) ); + } + + return coordinatePrecision; +} + /* * scan all points in the document and find those that simultaneously * belong to two curves c1 and c2. This is required when the user diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kig_document.h new/kig-4.8.0/kig/kig_document.h --- old/kig-4.7.4/kig/kig_document.h 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/kig/kig_document.h 2011-09-26 11:44:34.000000000 +0200 @@ -60,6 +60,9 @@ * Whether to enable visibility of hidden objects. */ bool mnightvision; + + int coordinatePrecision; + public: mutable double mcachedparam; public: @@ -72,6 +75,8 @@ bool grid() const; bool axes() const; bool getNightVision() const; + bool isUserSpecifiedCoordinatePrecision() const; + int getCoordinatePrecision() const; /** * Get a hold of the objects of this KigDocument. */ @@ -102,6 +107,8 @@ * set to enable/disable night-vision (visibility of hidden objects) */ void setNightVision( bool nv ); + + void setCoordinatePrecision( int precision ); /** * Return a vector of objects that contain the given point. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kig_part.cpp new/kig-4.8.0/kig/kig_part.cpp --- old/kig-4.7.4/kig/kig_part.cpp 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/kig/kig_part.cpp 2011-09-26 11:44:34.000000000 +0200 @@ -32,6 +32,7 @@ #include "../misc/calcpaths.h" #include "../misc/coordinate_system.h" #include "../misc/guiaction.h" +#include "../misc/kigcoordinateprecisiondialog.h" #include "../misc/kigpainter.h" #include "../misc/lists.h" #include "../misc/object_constructor.h" @@ -310,6 +311,11 @@ // a->setToolTip( i18n( "Select the area that you want to be shown in the window." ) ); // a->setWhatsThis( i18n( "Select the area that you want to be shown in the window." ) ); + aSetCoordinatePrecision = new KAction(i18n("Set Coordinate &Precision..."), this); + actionCollection()->addAction("settings_set_coordinate_precision", aSetCoordinatePrecision); + aSetCoordinatePrecision->setToolTip( i18n("Set the floating point precision of coordinates in the document. " )); + connect(aSetCoordinatePrecision, SIGNAL( triggered() ), this, SLOT( setCoordinatePrecision() )); + aToggleGrid = new KToggleAction(i18n("Show &Grid"), this); actionCollection()->addAction("settings_show_grid", aToggleGrid ); aToggleGrid->setToolTip( i18n( "Show or hide the grid." ) ); @@ -563,6 +569,18 @@ setModified( !clean ); } +void KigPart::setCoordinatePrecision() +{ + KigCoordinatePrecisionDialog dlg(document().isUserSpecifiedCoordinatePrecision(), document().getCoordinatePrecision() ); + + if( dlg.exec() == QDialog::Accepted ) + { + int coordinatePrecision = dlg.getUserSpecifiedCoordinatePrecision(); + + document().setCoordinatePrecision( coordinatePrecision ); + } +} + QUndoStack* KigPart::history() { return mhistory; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kig_part.desktop new/kig-4.8.0/kig/kig_part.desktop --- old/kig-4.7.4/kig/kig_part.desktop 2011-10-28 09:43:41.000000000 +0200 +++ new/kig-4.8.0/kig/kig_part.desktop 2011-12-20 20:12:34.000000000 +0100 @@ -31,7 +31,7 @@ Name[hr]=KigPart Name[hu]=KigPart Name[is]=KigPart -Name[it]=KigPart +Name[it]=Componente Kig Name[ja]=Kig コンポーネント Name[ka]=KigPart Name[kk]=KigPart бөлшегі diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kig_part.h new/kig-4.8.0/kig/kig_part.h --- old/kig-4.7.4/kig/kig_part.h 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/kig/kig_part.h 2011-09-26 11:44:34.000000000 +0200 @@ -125,6 +125,8 @@ void toggleNightVision(); void setHistoryClean( bool ); + + void setCoordinatePrecision(); /****************** cooperation with stuff ******************/ public: @@ -212,6 +214,7 @@ KAction* aShowHidden; KAction* aConfigureTypes; KAction* aBrowseHistory; + KAction* aSetCoordinatePrecision; KToggleAction* aToggleGrid; KToggleAction* aToggleAxes; KToggleAction* aToggleNightVision; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/kig/kigpartui.rc new/kig-4.8.0/kig/kigpartui.rc --- old/kig-4.7.4/kig/kigpartui.rc 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/kig/kigpartui.rc 2011-09-26 11:44:34.000000000 +0200 @@ -194,6 +194,7 @@ <Menu name="settings"> <Action name="fullscreen" /> <Action name="settings_set_coordinate_system" /> + <Action name="settings_set_coordinate_precision" /> <Action name="settings_show_grid" /> <Action name="settings_show_axes" /> <Action name="settings_toggle_nightvision" /> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/misc/coordinate_system.cpp new/kig-4.8.0/misc/coordinate_system.cpp --- old/kig-4.7.4/misc/coordinate_system.cpp 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/misc/coordinate_system.cpp 2011-09-26 11:44:34.000000000 +0200 @@ -153,9 +153,7 @@ // since an object isn't asked to recalc every time the widget size // changes.. might be a good idea to do that, but well, maybe some // other time :) - Rect sr = d.suggestedRect(); - double m = kigMax( sr.width(), sr.height() ); - int l = kigMax( 0, (int) ( 3 - log10( m ) ) ); + int l = d.getCoordinatePrecision(); QString xs = KGlobal::locale()->formatNumber( p.x, l ); QString ys = KGlobal::locale()->formatNumber( p.y, l ); return QString::fromLatin1( "( %1; %2 )" ).arg( xs ).arg( ys ); @@ -356,9 +354,7 @@ QString PolarCoords::fromScreen( const Coordinate& pt, const KigDocument& d ) const { - Rect sr = d.suggestedRect(); - double m = kigMax( sr.width(), sr.height() ); - int l = kigMax( 0, (int) ( 3 - log10( m ) ) ); + int l = d.getCoordinatePrecision(); double r = pt.length(); double theta = Goniometry::convert( atan2( pt.y, pt.x ), Goniometry::Rad, Goniometry::Deg ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/misc/kigcoordinateprecisiondialog.cpp new/kig-4.8.0/misc/kigcoordinateprecisiondialog.cpp --- old/kig-4.7.4/misc/kigcoordinateprecisiondialog.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kig-4.8.0/misc/kigcoordinateprecisiondialog.cpp 2011-09-26 11:44:34.000000000 +0200 @@ -0,0 +1,68 @@ +/** + This file is part of Kig, a KDE program for Interactive Geometry... + Copyright (C) 2002 Dominique Devriese <[email protected]> + + 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 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 +**/ + +#include "kigcoordinateprecisiondialog.h" + +#include <QBoxLayout> +#include <QCheckBox> +#include <QLabel> +#include <knuminput.h> + +#include <klocale.h> + +KigCoordinatePrecisionDialog::KigCoordinatePrecisionDialog(bool isUserSpecified, int currentPrecision ) : KDialog() +{ + ui = new Ui::KigCoordinatePrecisionDialog(); + ui->setupUi(mainWidget()); + + ui->m_defaultCheckBox->setCheckState( isUserSpecified ? Qt::Unchecked : Qt::Checked) ; + ui->m_precisionLabel->setEnabled( isUserSpecified ); + ui->m_precisionSpinBox->setEnabled( isUserSpecified ); + ui->m_precisionSpinBox->setValue( currentPrecision ); + + connect(ui->m_defaultCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( toggleCoordinateControls(int) )); + + show(); +} + +KigCoordinatePrecisionDialog::~KigCoordinatePrecisionDialog() +{ + delete ui; +} + +int KigCoordinatePrecisionDialog::getUserSpecifiedCoordinatePrecision() const +{ + if( ui->m_defaultCheckBox->checkState() == Qt::Unchecked ) + { + return ui->m_precisionSpinBox->value(); + } + + return -1; +} + +void KigCoordinatePrecisionDialog::toggleCoordinateControls( int state ) +{ + bool controlsEnabled = ( state == Qt::Unchecked ); + + ui->m_precisionLabel->setEnabled( controlsEnabled ); + ui->m_precisionSpinBox->setEnabled( controlsEnabled ); +} + +#include "kigcoordinateprecisiondialog.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/misc/kigcoordinateprecisiondialog.h new/kig-4.8.0/misc/kigcoordinateprecisiondialog.h --- old/kig-4.7.4/misc/kigcoordinateprecisiondialog.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kig-4.8.0/misc/kigcoordinateprecisiondialog.h 2011-09-26 11:44:34.000000000 +0200 @@ -0,0 +1,45 @@ +/** + This file is part of Kig, a KDE program for Interactive Geometry... + Copyright (C) 2002 Dominique Devriese <[email protected]> + + 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 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 +**/ + +#include <kdialog.h> + +#ifndef KIGCOORDINATEPRECISIONDIALOG_H +#define KIGCOORDINATEPRECISIONDIALOG_H + +#include <ui_kigcoordinateprecisiondialog.h> + +class KigCoordinatePrecisionDialog + : public KDialog +{ +Q_OBJECT + +public: + KigCoordinatePrecisionDialog(bool isUserSpecified, int currentPrecision ); + virtual ~KigCoordinatePrecisionDialog(); + int getUserSpecifiedCoordinatePrecision() const; + +private: + Ui::KigCoordinatePrecisionDialog* ui; + +private slots: + void toggleCoordinateControls( int state ); +}; + +#endif // KIGCOORDINATEPRECISIONDIALOG_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/misc/kigcoordinateprecisiondialog.ui new/kig-4.8.0/misc/kigcoordinateprecisiondialog.ui --- old/kig-4.7.4/misc/kigcoordinateprecisiondialog.ui 1970-01-01 01:00:00.000000000 +0100 +++ new/kig-4.8.0/misc/kigcoordinateprecisiondialog.ui 2011-09-26 11:44:34.000000000 +0200 @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>KigCoordinatePrecisionDialog</class> + <widget class="QWidget" name="KigCoordinatePrecisionDialog"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="m_defaultCheckBox"> + <property name="text"> + <string>&Use default coordinate precision</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="m_precisionLabel"> + <property name="text"> + <string>&Specify coordinate precision:</string> + </property> + <property name="buddy"> + <cstring>m_precisionSpinBox</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="m_precisionSpinBox"> + <property name="maximum"> + <number>15</number> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/misc/special_constructors.cc new/kig-4.8.0/misc/special_constructors.cc --- old/kig-4.7.4/misc/special_constructors.cc 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/misc/special_constructors.cc 2011-09-26 11:44:34.000000000 +0200 @@ -1821,11 +1821,25 @@ } QString MeasureTransportConstructor::selectStatement( - const std::vector<ObjectCalcer*>&, const KigDocument&, + const std::vector<ObjectCalcer*>& os, const KigDocument&, const KigWidget& ) const { -//TODO - return i18n("Select a point to be a vertex of the new polygon..."); + switch ( os.size() ) + { + case 0: + return i18n( "Select a segment, arc or numeric label to be transported..." ); + break; + + case 1: + return i18n( "Select a destination line or circle..." ); + break; + + case 2: + return i18n( "Choose a starting point on the line/circle..." ); + break; + } + + return ""; } std::vector<ObjectHolder*> MeasureTransportConstructor::build( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kig-4.7.4/pykig/pykig.py new/kig-4.8.0/pykig/pykig.py --- old/kig-4.7.4/pykig/pykig.py 2011-10-02 15:25:00.000000000 +0200 +++ new/kig-4.8.0/pykig/pykig.py 2012-01-02 20:52:21.000000000 +0100 @@ -1,17 +1,20 @@ #!/usr/bin/env python -# -*- coding: iso-8859-15 -*- +# -*- coding: utf-8 -*- #-------------------------------python------------------------pykig.py--# # # -# Da Python a Kig # +# From Python to Kig # # # #--Maurizio Paolini-Daniele Zambelli-----------------------------2005---# # -# (licenza GPL) +# Some comments translated to English by Bartosz Dziewoński +# during Google Code-In 2011 +# +# (licensed under GPL) version="0.2.11" ##### -# Type constant +# Type constants ##### TI=type(0) TF=type(0.) @@ -19,7 +22,7 @@ TT=type((0, 0)) ##### -# Constants: Point Style, Line Style, defaults values... +# Constants: Point Style, Line Style, default values... ##### PS=("Round", "RoundEmpty", "Rectangular", "RectangularEmpty", "Cross") LS=("SolidLine", "DashLine", "DashDotLine", "DashDotDotLine", "DotLine") @@ -32,17 +35,15 @@ OBJECT_INI="Object type" PROPERTY_END="Property" OBJECT_END="Object" -DICT=(("&","&"), ("<","<"), (">",">"), - ("�","à"), ("�","è"), ("�","ì"), ("�","ò"), ("�","ù"), ("�","é")) # -# this is a trick to allow definitions like "p=Point(0,0,HIDDEN)" +# this is a trick to allow definitions like "p=Point(0,0,HIDDEN)" # HIDDEN=KIGFALSE VISIBLE=KIGTRUE ##### -# Validation parameters +# Validating parameters ##### def parameter(val, defval): @@ -68,11 +69,11 @@ if type(color)==TS: return color ##### -# if as function +# if as a function ##### def rif(condition, val1, val2): - """Return val1 if condition is True else return val2.""" + """Return val1 if condition is True; else return val2.""" if condition: return val1 else: return val2 @@ -112,18 +113,18 @@ ##### ##### -# Classe KigDocument +# KigDocument class ##### class KigDocument(object): - """ Classe che produce il documento kig. + """A class representing a Kig document. - genealogia: + ancestor chain: KigDocument <- object - attributi di classe: + class attributes: - attributi: + attributes: axes grid outfilename @@ -140,7 +141,7 @@ shown color - metodi: + methods: viewappend hierarchyappend setcallkig @@ -178,7 +179,7 @@ KigView._kd=self self.viewkig=[] self.hierarchy=[] -# Defaults values +# Default values self.internal=False self.width=DEFWIDTH self.pointstyle=PS[0] @@ -194,7 +195,8 @@ def setof(v): self.of=v def str_open(self): - return """<!DOCTYPE KigDocument> + return """<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE KigDocument> <KigDocument axes="%s" grid="%s" CompatibilityVersion="0.7.0" Version="0.9.1" > <CoordinateSystem>Euclidean</CoordinateSystem> <Hierarchy> @@ -234,24 +236,24 @@ def setinternal(self, v): self.internal=v ##### -# Classe KigDOP +# KigDOP class ##### #class KigDOP(KigOut): class KigDOP(object): - """Classe da cui deriva ogni elemento che ha un id: Data, Object, Property. + """An class from which all elements having an id (Data, Object, Property) inherit. - genealogia: - kigDOP <- object + ancestor chain: + KigDOP <- object - attributo di classe: + class attributes: id-counter - attributi: + attributes: id type - metodi: + methods: getid str_hierarchy """ @@ -269,20 +271,20 @@ def str_hierarchy(self): pass ##### -# Classe KigView +# KigView class ##### #class KigView(KigOut): class KigView(object): - """ Classe con i dati di visualizzazione + """A class containing visualisation data. - genealogia: + ancestor chain: KigView <- object - attributi di classe: + class attributes: _kd - attributi: + attributes: shown width style @@ -290,7 +292,7 @@ name pointstyle - metodi: + methods: str_view show hide @@ -308,9 +310,9 @@ KigView._kd.viewappend(self) def str_view(self): - """Produce la stringa che viene scritta sotto <View>. + """Returns a string which can be placed inside <View> tags. - esempio: + example: <Draw width="-1" point-style="Round" namecalcer="none" style="SolidLine" shown=None color="#0000ff" object="3" /> """ @@ -321,19 +323,19 @@ self.linestyle, self.shown, self.color, self.object.getid()) ##### -# Classe Data +# Data class ##### class Data(KigDOP): - """ Classe da cui deriva ogni elemento Data + """An class from which all Data elements inherit. - genealogia: + ancestor chain: Data <- KigDOP <- object - attributi: + attributes: val - metodi: + methods: str_hierarchy """ def __init__(self, type, val): @@ -341,32 +343,32 @@ KigDOP.__init__(self, type) def str_hierarchy(self): - """Produce la stringa che viene scritta sotto <Data>. + """Returns a string which can be placed inside <Hierarchy> tags. - esempio: + example: <Data type="double" id="170" >0.1</Data> """ return ' <Data type="%s" id="%s" >%s</Data>\n' % \ (self._type, self.getid(), self.val) ##### -# Classe PropObj +# PropObj class ##### class PropObj(KigDOP): - """ Classe da cui deriva ogni elemento visibile + """A class from which all visible elements inherit. - genealogia: + ancestor chain: PropObj <- KigDOP <- object - attributi di classe: + class attributes: - attributi: + attributes: prop objvec view - metodi: + methods: str_hierarchy showname(self, n) show(self) @@ -393,8 +395,8 @@ if internal: self.view = None else: -# Qui si assume che, se viene dato un nome ad un oggetto, -# si voglia anche visualizzare questo nome +# Here we assume that, if we're given a name of an object, +# we want to visualize the name as well if name: n_id=self.showname(name, shown, width, pointstyle, linestyle, color) else: n_id=None @@ -402,14 +404,14 @@ color) def str_hierarchy(self): - """Produce la stringa che viene scritta sotto <Data>. + """Returns a string which can be placed inside <Hierarchy> tags. - esempio: + example: <Property which="mid-point" id="170" > <Parent id="..." /> </Property> - oppure: + example: <Object type="ConstrainedPoint" id="14" > <Parent id="13" /> <Parent id="10" /> @@ -448,13 +450,13 @@ def setshown(self, s): self.view.shown=s ##### -# Classe Property +# Property class ##### class Property(PropObj): - """ Classe da cui deriva ogni elemento Property + """A class from which all Property elements inherit. - genealogia: + ancestor chain: Property <- PropObj <- KigDOP <- object """ def __init__(self, type, parent, shown, name, internal, @@ -464,13 +466,13 @@ # print shown ##### -# Classe Object +# Object class ##### class Object(PropObj): - """ Classe da cui deriva ogni elemento Oggetto + """A class from which all Object elements inherit. - genealogia: + ancestor chain: Object <- PropObj <- KigDOP <- object """ @@ -486,14 +488,9 @@ data=(\ ("Int", "int", "val"), ("Double", "double", "val"), -("String", "string", "convstr(val)"), +("String", "string", "xml.sax.saxutils.escape(val)"), ) -def convstr(s): - for o, n in DICT: - s=s.replace(o, n) - return s - def databuild(nomeclasse, nomekig, v="val"): """Create string with a Data class definition.""" return """class %s(Data): @@ -509,11 +506,11 @@ ##### # Objects ##### -"""Da aggiungere: -("ConvexHall", "ConvexHall", "polygon,", "(polygon,),"), +"""To add: +("ConvexHull", "ConvexHull", "polygon,", "(polygon,),"), ("EllipseByFocusFocusPoint", "EllipseBFFP", "p1, p2, p3,", "(p1, p2, p3,),"), ("HyperbolaByFocusFocusPoint", "HyperbolaBFFP", "p1, p2, p3,", "(p1, p2, p3,),"), -(ConicsBy5Points", "ConicB5P", "p1, p2, p3, p4, p5,", "(p1, p2, p3, p4, p5),"), +("ConicBy5Points", "ConicB5P", "p1, p2, p3, p4, p5,", "(p1, p2, p3, p4, p5),"), ("ParabolaBy3Points", "ParabolaBTP", "p1, p2, p3,", "(p1, p2, p3,),"), ("CocCurve", "CocCurve", "line, point,", "(line, point,),"), """ @@ -524,7 +521,7 @@ "t, curve,", "(kig_double(t), curve),"), ("RelativePoint", "RelativePoint", "x, y, p,", "(kig_double(x), kig_double(y), p),"), -###### segments, rays, lines +###### Segments, rays, lines ("Line", "LineAB", "p1, p2,", "(p1, p2),"), ("Segment", "SegmentAB", "p1, p2,", "(p1, p2),"), ("Ray", "RayAB", "p1, p2,", "(p1, p2),"), @@ -549,15 +546,14 @@ #### Cubics ("CubicBy9Points", "CubicB9P", "p1, p2, p3, p4, p5, p6, p7, p8, p9,","(p1, p2, p3, p4, p5, p6, p7, p8, p9,)," ), ##### -# intersections. The only standard object is the intersection -# of two lines, which always gives one single point +# Intersections. The only standard object is the intersection +# of two lines, which always gives one single point. ##### ("LineLineIntersection", "LineLineIntersection", "l1, l2,", "(l1, l2),"), ##### -# Classe CircleCircleIntersection e ConicLineIntersection -# l'intero "which" puo' assumere i valori 1 o -1 per indicare quale -# delle due intersezioni si desidera ottenere -# si potrebbe mettere un controllo... +# CircleCircleIntersection and ConicLineIntersection classes +# The "which" argument takes values of 1 or -1, to indicate +# which of the intersections you want to get. ##### ("CircleCircleIntersection", "CircleCircleIntersection", "c1, c2, which,", "(c1, c2, Int(which),),"), @@ -568,22 +564,22 @@ ("CubicLineIntersection", "CubicLineIntersection", "cubic, line, which,", "(cubic, line, Int(which),),"), ("CubicLineOtherIntersection", "CubicLineOtherIntersection", "cubic, line, p1, p2,", "(cubic, line, p1, p2),"), -###### Classe Triangle +###### Triangle class ("Triangle", "TriangleB3P", "p1, p2, p3,", "(p1, p2, p3),"), -###### Classe Polygon (the only argument is a points vect) +###### Polygon class (the only argument is a points vect) ("Polygon", "PolygonBNP", "pvec,", "pvec,"), -###### Classe PolygonBCV -# Poligono regolare dati il centro e un vertice; il terzo argomento -# e' un intero contenente il numero di lati +###### PolygonBCV class +# Regular polygon data - center and a vertex. The third argument +# is an integer signifying the number of sides. ("PolygonBCV", "PoligonBCV", "center, vertex, n,", "(center, vertex, Int(n)),"), -##### Classe PolygonVertex (poligono, intero >= 0) +##### PolygonVertex class (polygon, integer >= 0) ("PolygonVertex", "PolygonVertex", "polygon, i,", "(polygon, Int(i)),"), -##### Classe PolygonSide (poligono, intero >= 0) +##### PolygonSide class (polygon, integer >= 0) ("PolygonSide", "PolygonSide", "polygon, i,", "(polygon, Int(i)),"), -###### vector, angle,... +###### Vector, angle,... ("Vector", "Vector", "p1, p2,", "(p1, p2),"), ("Angle", "Angle", "p1, v, p2,", "(p1, v, p2),"), ###### Transformations @@ -646,7 +642,7 @@ exec objectbuild(p1, p2, p3, p4) ##### -# Propertys +# Properties ##### property=(\ @@ -689,9 +685,9 @@ exec propertybuild(p1, p2, p3, p4) ##### -# Start of properties definitions as Object's metod +# Start of properties definitions as Object's methods ##### -# da sistemare! +# to be cleaned up! points =(Point, ConstrainedPoint, RelativePoint, PolygonVertex) lines=(Segment, Ray, Vector, InvertLine) segments=(Segment, Vector, PolygonSide, InvertSegment) @@ -747,9 +743,9 @@ Options: -h, --help Show this text. -o <kig_file> - --output <kig_file> output <kig_file> no call Kig - -v, --version output version - -n, --nokig no call Kig + --output <kig_file> Output to <kig_file> and don't call Kig. + -v, --version Output version and exit. + -n, --nokig Don't call Kig. examples: $ pykig.py my_file.kpy @@ -767,6 +763,7 @@ import math # for user's programs import getopt import atexit +import xml.sax.saxutils def prog(): try: @@ -781,28 +778,28 @@ if _opt in ("-h", "--help"): usage(0) if _opt in ("-v", "--version"): - print "version:", version + print "Version:", version sys.exit(0) if _opt in ("-n", "--nokig"): _callKig=False elif _opt in ("-o", "--output"): _outfilename=_arg _of=True - _callKig=False # se c'� il file di output, non viene chiamato Kig + _callKig=False # if there's an output file, don't call Kig if len(_args)==0: - _infilename=raw_input("Nome del file di input: ") + _infilename=raw_input("Input file name: ") if not _infilename: - print "No Input filename" + print "No input file name." usage(2) elif len(_args)==1: _infilename=_args[0] else: - print "No infilename" + print "No input file name." usage(2) try: _infile = open(_infilename, 'r') except: - print >> sys.stderr, _infilename, 'unreadable' + print >> sys.stderr, _infilename, "input file can't be read." sys.exit(2) if _of: if _outfilename=="-": @@ -816,8 +813,8 @@ try: execfile(_infilename, globals()) except: - print >> sys.stderr, 'syntax error in', _infilename - _info = sys.exc_info() # vorrei stampare il traceback... + print >> sys.stderr, 'Syntax error in', _infilename + _info = sys.exc_info() # print out the traceback traceback.print_exc() sys.exit(3) kigdocument.close() -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
