Added tools menu for paintbrush
This commit is contained in:
parent
37bd127888
commit
d13b6588f7
|
|
@ -47,6 +47,7 @@ def onKeyDownFrame(self, key):
|
||||||
svlgui.MODE=key
|
svlgui.MODE=key
|
||||||
svlgui.set_cursor({" ":"arrow","s":"arrow","r":"crosshair","e":"crosshair",
|
svlgui.set_cursor({" ":"arrow","s":"arrow","r":"crosshair","e":"crosshair",
|
||||||
"b":"arrow"}[key], MainWindow.stage)
|
"b":"arrow"}[key], MainWindow.stage)
|
||||||
|
misc_funcs.update_tooloptions()
|
||||||
elif key=="F6":
|
elif key=="F6":
|
||||||
add_keyframe()
|
add_keyframe()
|
||||||
MainWindow.scriptwindow.text = root.descendItem().activelayer.frames[root.descendItem().activelayer.currentframe].actions
|
MainWindow.scriptwindow.text = root.descendItem().activelayer.frames[root.descendItem().activelayer.currentframe].actions
|
||||||
|
|
@ -125,6 +126,7 @@ def onKeyDownGroup(self, key):
|
||||||
svlgui.MODE=key
|
svlgui.MODE=key
|
||||||
svlgui.set_cursor({" ":"arrow","s":"arrow","r":"crosshair","e":"crosshair",
|
svlgui.set_cursor({" ":"arrow","s":"arrow","r":"crosshair","e":"crosshair",
|
||||||
"b":"arrow","p":"arrow"}[key], MainWindow.stage)
|
"b":"arrow","p":"arrow"}[key], MainWindow.stage)
|
||||||
|
misc_funcs.update_tooloptions()
|
||||||
elif key=="F6":
|
elif key=="F6":
|
||||||
add_keyframe()
|
add_keyframe()
|
||||||
print "Added keyframe."
|
print "Added keyframe."
|
||||||
|
|
@ -135,6 +137,7 @@ def onKeyDownObj(self, key):
|
||||||
svlgui.MODE=key
|
svlgui.MODE=key
|
||||||
svlgui.set_cursor({" ":"arrow","s":"arrow","r":"crosshair","e":"crosshair",
|
svlgui.set_cursor({" ":"arrow","s":"arrow","r":"crosshair","e":"crosshair",
|
||||||
"b":"arrow","p":"arrow"}[key], MainWindow.stage)
|
"b":"arrow","p":"arrow"}[key], MainWindow.stage)
|
||||||
|
misc_funcs.update_tooloptions()
|
||||||
elif key=="F6":
|
elif key=="F6":
|
||||||
add_keyframe()
|
add_keyframe()
|
||||||
|
|
||||||
|
|
@ -209,12 +212,13 @@ root.onMouseUp = onMouseUpGroup
|
||||||
root.onMouseMove = onMouseMoveGroup
|
root.onMouseMove = onMouseMoveGroup
|
||||||
root.onMouseDrag = onMouseDragGroup
|
root.onMouseDrag = onMouseDragGroup
|
||||||
root.onKeyDown = onKeyDownGroup
|
root.onKeyDown = onKeyDownGroup
|
||||||
|
'''
|
||||||
e=ellipse(100,100,10,10,None)
|
e=ellipse(100,100,10,10,None)
|
||||||
e.onMouseDown = onMouseDownObj
|
e.onMouseDown = onMouseDownObj
|
||||||
e.onMouseMove = onMouseMoveObj
|
e.onMouseMove = onMouseMoveObj
|
||||||
e.onMouseDrag = onMouseDragObj
|
e.onMouseDrag = onMouseDragObj
|
||||||
e.onMouseUp = onMouseUpObj
|
e.onMouseUp = onMouseUpObj
|
||||||
e.onKeyDown = onKeyDownObj
|
e.onKeyDown = onKeyDownObj'''
|
||||||
root.add(e)
|
root.add(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,12 @@ class MainWindowOSX:
|
||||||
[self.paintgroup[1],0,0,self.paintgroup[0]._int(),None,"new",""],
|
[self.paintgroup[1],0,0,self.paintgroup[0]._int(),None,"new",""],
|
||||||
[self.paintgroup[2],0,0,self.paintgroup[1]._int(),None,"new",""])
|
[self.paintgroup[2],0,0,self.paintgroup[1]._int(),None,"new",""])
|
||||||
#)
|
#)
|
||||||
|
svlgui.TOOLOPTIONS = {self.paintbox:"p"}
|
||||||
|
for i in svlgui.TOOLOPTIONS:
|
||||||
|
if svlgui.MODE==svlgui.TOOLOPTIONS[i]:
|
||||||
|
i.setvisible(True)
|
||||||
|
else:
|
||||||
|
i.setvisible(False)
|
||||||
self.frame.layout_self( [self.toolbox,0,None,0,None,"nw",""],
|
self.frame.layout_self( [self.toolbox,0,None,0,None,"nw",""],
|
||||||
#[self.paintbox,0,245,0,0,"nws","v"],
|
#[self.paintbox,0,245,0,0,"nws","v"],
|
||||||
[self.timelinebox,self.toolbox._int()+148,-500,0,None,"new","hv"],
|
[self.timelinebox,self.toolbox._int()+148,-500,0,None,"new","hv"],
|
||||||
|
|
@ -239,7 +245,7 @@ class MainWindowOSX:
|
||||||
#[self.layerbox,self.paintbox._int(),self.toolbox._int().width+150,0,None,"n","v"],
|
#[self.layerbox,self.paintbox._int(),self.toolbox._int().width+150,0,None,"n","v"],
|
||||||
[self.scriptwindow,self.timelinebox._int(),0,0,0,"nse", "hv"],
|
[self.scriptwindow,self.timelinebox._int(),0,0,0,"nse", "hv"],
|
||||||
[self.stage,self.toolbox._int(),self.scriptwindow._int(),self.timelinebox._int()+2,0,"nsew", "hv"],
|
[self.stage,self.toolbox._int(),self.scriptwindow._int(),self.timelinebox._int()+2,0,"nsew", "hv"],
|
||||||
[self.paintbox,0,self.stage._int(),self.toolbox._int(),0,"nws","v"] )
|
[self.paintbox,0,self.stage._int(),self.toolbox._int(),None,"nw","v"] )
|
||||||
#[self.stage,self.paintbox._int(),self.scriptwindow._int(),self.timelinebox._int()+2,0,"nsew", "hv"] )
|
#[self.stage,self.paintbox._int(),self.scriptwindow._int(),self.timelinebox._int()+2,0,"nsew", "hv"] )
|
||||||
self.window.add(self.frame)
|
self.window.add(self.frame)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,33 +10,50 @@ import math
|
||||||
def select_any(self):
|
def select_any(self):
|
||||||
svlgui.MODE = " "
|
svlgui.MODE = " "
|
||||||
svlgui.set_cursor("arrow", stage)
|
svlgui.set_cursor("arrow", stage)
|
||||||
|
update_tooloptions()
|
||||||
def resize_any(self):
|
def resize_any(self):
|
||||||
svlgui.MODE = "s"
|
svlgui.MODE = "s"
|
||||||
svlgui.set_cursor("arrow", stage)
|
svlgui.set_cursor("arrow", stage)
|
||||||
|
update_tooloptions()
|
||||||
def lasso(self):
|
def lasso(self):
|
||||||
svlgui.MODE = "l"
|
svlgui.MODE = "l"
|
||||||
svlgui.set_cursor("lasso", stage)
|
svlgui.set_cursor("lasso", stage)
|
||||||
|
update_tooloptions()
|
||||||
def text(self):
|
def text(self):
|
||||||
svlgui.MODE = "t"
|
svlgui.MODE = "t"
|
||||||
svlgui.set_cursor("text", stage)
|
svlgui.set_cursor("text", stage)
|
||||||
|
update_tooloptions()
|
||||||
def rectangle(self):
|
def rectangle(self):
|
||||||
svlgui.MODE = "r"
|
svlgui.MODE = "r"
|
||||||
svlgui.set_cursor("crosshair", stage)
|
svlgui.set_cursor("crosshair", stage)
|
||||||
|
update_tooloptions()
|
||||||
def ellipse(self):
|
def ellipse(self):
|
||||||
svlgui.MODE = "e"
|
svlgui.MODE = "e"
|
||||||
svlgui.set_cursor("crosshair", stage)
|
svlgui.set_cursor("crosshair", stage)
|
||||||
|
update_tooloptions()
|
||||||
def curve(self):
|
def curve(self):
|
||||||
svlgui.MODE = "c"
|
svlgui.MODE = "c"
|
||||||
svlgui.set_cursor("curve", stage)
|
svlgui.set_cursor("curve", stage)
|
||||||
|
update_tooloptions()
|
||||||
def paintbrush(self):
|
def paintbrush(self):
|
||||||
svlgui.MODE = "p"
|
svlgui.MODE = "p"
|
||||||
svlgui.set_cursor("paintbrush", stage)
|
svlgui.set_cursor("paintbrush", stage)
|
||||||
|
update_tooloptions()
|
||||||
def pen(self):
|
def pen(self):
|
||||||
svlgui.MODE = "n"
|
svlgui.MODE = "n"
|
||||||
svlgui.set_cursor("pen", stage)
|
svlgui.set_cursor("pen", stage)
|
||||||
|
update_tooloptions()
|
||||||
def paint_bucket(self):
|
def paint_bucket(self):
|
||||||
svlgui.MODE = "b"
|
svlgui.MODE = "b"
|
||||||
svlgui.set_cursor("bucket", stage)
|
svlgui.set_cursor("bucket", stage)
|
||||||
|
update_tooloptions()
|
||||||
|
|
||||||
|
def update_tooloptions():
|
||||||
|
for i in svlgui.TOOLOPTIONS:
|
||||||
|
if svlgui.MODE==svlgui.TOOLOPTIONS[i]:
|
||||||
|
i.setvisible(True)
|
||||||
|
else:
|
||||||
|
i.setvisible(False)
|
||||||
|
|
||||||
def box(x, y, width, height, fill):
|
def box(x, y, width, height, fill):
|
||||||
global objects
|
global objects
|
||||||
|
|
|
||||||
11
svlgui.py
11
svlgui.py
|
|
@ -24,7 +24,7 @@ import re
|
||||||
# "n": pen tool
|
# "n": pen tool
|
||||||
# "b": paint bucket tool
|
# "b": paint bucket tool
|
||||||
'''
|
'''
|
||||||
MODE="e"
|
MODE=" "
|
||||||
|
|
||||||
#Painbrush mode
|
#Painbrush mode
|
||||||
PMODE = "Draw straight"
|
PMODE = "Draw straight"
|
||||||
|
|
@ -618,6 +618,8 @@ class Frame(Widget):
|
||||||
if SYSTEM=="osx":
|
if SYSTEM=="osx":
|
||||||
for i in args:
|
for i in args:
|
||||||
self.frame.place(i[0]._int(),left=i[1],right=i[2],top=i[3],bottom=i[4],sticky=i[5], scrolling=i[6])
|
self.frame.place(i[0]._int(),left=i[1],right=i[2],top=i[3],bottom=i[4],sticky=i[5], scrolling=i[6])
|
||||||
|
self.width = self.frame.width
|
||||||
|
self.height = self.frame.height
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
for i in args:
|
for i in args:
|
||||||
i[0]._int().style["position"]="absolute"
|
i[0]._int().style["position"]="absolute"
|
||||||
|
|
@ -638,6 +640,13 @@ class Frame(Widget):
|
||||||
else:
|
else:
|
||||||
i[0]._int().style["overflow-y"]="hidden"
|
i[0]._int().style["overflow-y"]="hidden"
|
||||||
self.frame.add(i[0]._int())
|
self.frame.add(i[0]._int())
|
||||||
|
def setvisible(self,visible):
|
||||||
|
if SYSTEM=="osx":
|
||||||
|
if visible:
|
||||||
|
self.frame.height = self.height
|
||||||
|
else:
|
||||||
|
self.frame.height = 0
|
||||||
|
|
||||||
class Canvas(Widget):
|
class Canvas(Widget):
|
||||||
def __init__(self,width=False,height=False):
|
def __init__(self,width=False,height=False):
|
||||||
self.objs=[]
|
self.objs=[]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue