# HG changeset patch # User Thinker K.F. Li # Date 1229307440 -28800 # Node ID 5c70883c40d571c6e8669972363d90858dcbfe5a # Parent 29e1b2bffe4ce4180d04230d5ea6a2a48f2e3e89# Parent ad5c7a5c2c39afabe4b71930062eb00a5db700d0 merge with changeset ad5c7a5c2c39 diff -r 29e1b2bffe4c -r 5c70883c40d5 inkscape/MB_EditActiveButton.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inkscape/MB_EditActiveButton.py Mon Dec 15 10:17:20 2008 +0800 @@ -0,0 +1,70 @@ +#!/usr/bin/python +import inkex +import pygtk +import gtk +from copy import deepcopy + +class ConvertToButton(inkex.Effect): + def effect(self): + self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.window.set_position(gtk.WIN_POS_MOUSE) + self.defaultname = 'input symbol name here' + if self.fillcontent() == False: + self.window.show_all() + self.window.connect("delete_event", gtk.main_quit) + gtk.main() + def onQuit(self,data): + gtk.main_quit() + def onAssign(self,data): + text = self.text.get_text() + if text != self.defaultname: + self.node.set("mbname",text) + gtk.main_quit() + + def confirm(self,msg): + vbox = gtk.VBox() + vbox.pack_start(gtk.Label(msg)) + self.button = gtk.Button('OK') + vbox.pack_start(self.button) + self.button.connect("clicked", self.onQuit) + self.window.add(vbox) + def dumpattr(self,n): + s = "" + for a,v in n.attrib.items(): + s = s + ("%s=%s" % (a,v)) + return s + + def dump(self,node,l=0): + print " " * l*2,"<", node.tag, self.dumpattr(node),">" + for n in node: + self.dump(n,l+1) + print " " * l * 2,"/>" + + def hide_frame(self,frame): + frame.set('style','display:none') + def show_frame(self,frame): + frame.set('style','') + + + def fillcontent(self): + if len(self.selected) != 1: + self.confirm('Please select one group only') + return False + for id,node in self.selected.iteritems(): + #self.dump(node) + name = node.get("mbname") + if name == None: + self.confirm("The MadButterFly symbol is not defined yet. Please convert it to the symbol before convert it to button.") + return False + for frame in node: + if frame.get('mbname') == name+'_active': + self.show_frame(frame) + else: + self.hide_frame(frame) + return True + + +a=ConvertToButton() +a.affect() + +# vim: set ts=4 diff -r 29e1b2bffe4c -r 5c70883c40d5 inkscape/MB_EditClickButton.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inkscape/MB_EditClickButton.py Mon Dec 15 10:17:20 2008 +0800 @@ -0,0 +1,70 @@ +#!/usr/bin/python +import inkex +import pygtk +import gtk +from copy import deepcopy + +class ConvertToButton(inkex.Effect): + def effect(self): + self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.window.set_position(gtk.WIN_POS_MOUSE) + self.defaultname = 'input symbol name here' + if self.fillcontent() == False: + self.window.show_all() + self.window.connect("delete_event", gtk.main_quit) + gtk.main() + def onQuit(self,data): + gtk.main_quit() + def onAssign(self,data): + text = self.text.get_text() + if text != self.defaultname: + self.node.set("mbname",text) + gtk.main_quit() + + def confirm(self,msg): + vbox = gtk.VBox() + vbox.pack_start(gtk.Label(msg)) + self.button = gtk.Button('OK') + vbox.pack_start(self.button) + self.button.connect("clicked", self.onQuit) + self.window.add(vbox) + def dumpattr(self,n): + s = "" + for a,v in n.attrib.items(): + s = s + ("%s=%s" % (a,v)) + return s + + def dump(self,node,l=0): + print " " * l*2,"<", node.tag, self.dumpattr(node),">" + for n in node: + self.dump(n,l+1) + print " " * l * 2,"/>" + + def hide_frame(self,frame): + frame.set('style','display:none') + def show_frame(self,frame): + frame.set('style','') + + + def fillcontent(self): + if len(self.selected) != 1: + self.confirm('Please select one group only') + return False + for id,node in self.selected.iteritems(): + #self.dump(node) + name = node.get("mbname") + if name == None: + self.confirm("The MadButterFly symbol is not defined yet. Please convert it to the symbol before convert it to button.") + return False + for frame in node: + if frame.get('mbname') == name+'_click': + self.show_frame(frame) + else: + self.hide_frame(frame) + return True + + +a=ConvertToButton() +a.affect() + +# vim: set ts=4 diff -r 29e1b2bffe4c -r 5c70883c40d5 inkscape/MB_EditNormalButton.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inkscape/MB_EditNormalButton.py Mon Dec 15 10:17:20 2008 +0800 @@ -0,0 +1,70 @@ +#!/usr/bin/python +import inkex +import pygtk +import gtk +from copy import deepcopy + +class ConvertToButton(inkex.Effect): + def effect(self): + self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.window.set_position(gtk.WIN_POS_MOUSE) + self.defaultname = 'input symbol name here' + if self.fillcontent() == False: + self.window.show_all() + self.window.connect("delete_event", gtk.main_quit) + gtk.main() + def onQuit(self,data): + gtk.main_quit() + def onAssign(self,data): + text = self.text.get_text() + if text != self.defaultname: + self.node.set("mbname",text) + gtk.main_quit() + + def confirm(self,msg): + vbox = gtk.VBox() + vbox.pack_start(gtk.Label(msg)) + self.button = gtk.Button('OK') + vbox.pack_start(self.button) + self.button.connect("clicked", self.onQuit) + self.window.add(vbox) + def dumpattr(self,n): + s = "" + for a,v in n.attrib.items(): + s = s + ("%s=%s" % (a,v)) + return s + + def dump(self,node,l=0): + print " " * l*2,"<", node.tag, self.dumpattr(node),">" + for n in node: + self.dump(n,l+1) + print " " * l * 2,"/>" + + def hide_frame(self,frame): + frame.set('style','display:none') + def show_frame(self,frame): + frame.set('style','') + + + def fillcontent(self): + if len(self.selected) != 1: + self.confirm('Please select one group only') + return False + for id,node in self.selected.iteritems(): + #self.dump(node) + name = node.get("mbname") + if name == None: + self.confirm("The MadButterFly symbol is not defined yet. Please convert it to the symbol before convert it to button.") + return False + for frame in node: + if frame.get('mbname') == name+'_normal': + self.show_frame(frame) + else: + self.hide_frame(frame) + return True + + +a=ConvertToButton() +a.affect() + +# vim: set ts=4 diff -r 29e1b2bffe4c -r 5c70883c40d5 inkscape/MB_button_select_click.inx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inkscape/MB_button_select_click.inx Mon Dec 15 10:17:20 2008 +0800 @@ -0,0 +1,18 @@ + + Edit Click button + MadButterfly.EditClickButton + MB_EditClickButton.py + inkex.py + + any + + + + + + + + + diff -r 29e1b2bffe4c -r 5c70883c40d5 inkscape/MB_button_select_normal.inx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inkscape/MB_button_select_normal.inx Mon Dec 15 10:17:20 2008 +0800 @@ -0,0 +1,18 @@ + + Edit Normal button + MadButterfly.EditNormalButton + MB_EditNormalButton.py + inkex.py + + any + + + + + + + + +