From 2e8f7af830a883b769f3c2079049da51e4c8bdf3 Mon Sep 17 00:00:00 2001 From: aurium Date: Thu, 16 Apr 2009 20:17:24 +0000 Subject: [PATCH] replaced "-" to "_" in the interp_att_g extension name to be usable as module and added a notification for a execution without selection. --- share/extensions/Makefile.am | 4 ++-- .../{interp-att-g.inx => interp_att_g.inx} | 4 ++-- .../{interp-att-g.py => interp_att_g.py} | 18 +++++++++++++----- ...terp-att-g.test.py => interp_att_g.test.py} | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) rename share/extensions/{interp-att-g.inx => interp_att_g.inx} (93%) rename share/extensions/{interp-att-g.py => interp_att_g.py} (95%) rename share/extensions/test/{interp-att-g.test.py => interp_att_g.test.py} (96%) diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 01577acf5..3d08ee798 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -71,7 +71,7 @@ extensions = \ inkwebeffect.py \ inkweb.js \ interp.py \ - interp-att-g.py \ + interp_att_g.py \ launch_webbrowser.py \ lindenmayer.py \ lorem_ipsum.py \ @@ -194,7 +194,7 @@ modules = \ inkscape_help_svgspec.inx \ inkscape_help_keys.inx \ interp.inx \ - interp-att-g.inx \ + interp_att_g.inx \ lindenmayer.inx \ lorem_ipsum.inx \ markers_strokepaint.inx \ diff --git a/share/extensions/interp-att-g.inx b/share/extensions/interp_att_g.inx similarity index 93% rename from share/extensions/interp-att-g.inx rename to share/extensions/interp_att_g.inx index 504833db5..cd78abccf 100644 --- a/share/extensions/interp-att-g.inx +++ b/share/extensions/interp_att_g.inx @@ -2,7 +2,7 @@ <_name>Interpolate Attribute in a group org.inkscape.filter.interp-att-g - interp-att-g.py + interp_att_g.py inkex.py <_param name="intro" type="description">This effect applies a value for any interpolatable attribute for all elements inside the selected group or for all elements in a multiple selection @@ -46,6 +46,6 @@ diff --git a/share/extensions/interp-att-g.py b/share/extensions/interp_att_g.py similarity index 95% rename from share/extensions/interp-att-g.py rename to share/extensions/interp_att_g.py index 021d7b711..503e4ec60 100755 --- a/share/extensions/interp-att-g.py +++ b/share/extensions/interp_att_g.py @@ -99,6 +99,9 @@ class InterpAttG(inkex.Effect): def getTotElements(self): self.tot_el = 0 + self.collection = None + if len( self.selected ) == 0: + return False if len( self.selected ) > 1: # multiple selection self.collection = self.options.ids @@ -148,9 +151,9 @@ class InterpAttG(inkex.Effect): else: self.getNumberValues() - #inkex.errormsg( 'R+: '+ str( self.R_inc ) ) - #inkex.errormsg( 'G+: '+ str( self.G_inc ) ) - #inkex.errormsg( 'B+: '+ str( self.B_inc ) ) + if self.collection is None: + inkex.errormsg( 'There is no selection to interpolate' ) + return False for node in self.collection: if self.inte_att_type == 'color': @@ -192,6 +195,11 @@ class InterpAttG(inkex.Effect): else: self.val_cur += self.val_inc -if __name__ == '__main__': + return True + +if __name__ == '__main__': #pragma: no cover e = InterpAttG() - e.affect() + if e.affect(): + exit(0) + else: + exit(1) diff --git a/share/extensions/test/interp-att-g.test.py b/share/extensions/test/interp_att_g.test.py similarity index 96% rename from share/extensions/test/interp-att-g.test.py rename to share/extensions/test/interp_att_g.test.py index f35a7a167..d7cec126c 100755 --- a/share/extensions/test/interp-att-g.test.py +++ b/share/extensions/test/interp_att_g.test.py @@ -10,7 +10,7 @@ import sys sys.path.append('..') # this line allows to import the extension code import unittest -from interp-att-g import * +from interp_att_g import * class InterpAttGBasicTest(unittest.TestCase): -- 2.30.2