Color selection windows close automatically
This commit is contained in:
parent
d13b6588f7
commit
852003809b
|
|
@ -177,8 +177,10 @@ def run_file(self=None):
|
||||||
osx_flash_player_loc = "/Applications/Flash\ Player\ Debugger.app"
|
osx_flash_player_loc = "/Applications/Flash\ Player\ Debugger.app"
|
||||||
svlgui.execute("open -a "+osx_flash_player_loc+" test.swf")
|
svlgui.execute("open -a "+osx_flash_player_loc+" test.swf")
|
||||||
elif svlgui.PLATFORM=='win32':
|
elif svlgui.PLATFORM=='win32':
|
||||||
|
win_flash_player_loc = ""
|
||||||
svlgui.execute('start '+win_flash_player_loc+" test.swf")
|
svlgui.execute('start '+win_flash_player_loc+" test.swf")
|
||||||
elif svlgui.PLATFORM.startswith('linux'):
|
elif svlgui.PLATFORM.startswith('linux'):
|
||||||
|
linux_flash_player_loc = ""
|
||||||
svlgui.execute('xdg-open '+linux_flash_player_loc+" test.swf")
|
svlgui.execute('xdg-open '+linux_flash_player_loc+" test.swf")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -218,8 +220,8 @@ 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)'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
22
svlgui.py
22
svlgui.py
|
|
@ -37,6 +37,8 @@ CURRENTFRAME=0
|
||||||
#Object which has the keyboard focus.
|
#Object which has the keyboard focus.
|
||||||
FOCUS = None
|
FOCUS = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Library. Contatins all objects whether displayed or not.
|
#Library. Contatins all objects whether displayed or not.
|
||||||
Library = []
|
Library = []
|
||||||
|
|
||||||
|
|
@ -241,7 +243,12 @@ if SYSTEM=="osx":
|
||||||
app = Lightningbeam()
|
app = Lightningbeam()
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
app = ""
|
app = ""
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectDeletedError:
|
||||||
|
def __str__(self):
|
||||||
|
return "Object deleted!"
|
||||||
|
|
||||||
|
|
||||||
class htmlobj:
|
class htmlobj:
|
||||||
"""
|
"""
|
||||||
|
|
@ -687,8 +694,11 @@ class Canvas(Widget):
|
||||||
def mouse_down(self, event):
|
def mouse_down(self, event):
|
||||||
self.become_target()
|
self.become_target()
|
||||||
x, y = event.position
|
x, y = event.position
|
||||||
for i in self.objs:
|
try:
|
||||||
i._onMouseDown(x, y)
|
for i in self.objs:
|
||||||
|
i._onMouseDown(x, y)
|
||||||
|
except ObjectDeletedError:
|
||||||
|
return
|
||||||
self.invalidate_rect([0,0,self.extent[0],self.extent[1]])
|
self.invalidate_rect([0,0,self.extent[0],self.extent[1]])
|
||||||
|
|
||||||
def mouse_drag(self, event):
|
def mouse_drag(self, event):
|
||||||
|
|
@ -1614,8 +1624,8 @@ class Group (object):
|
||||||
self.activelayer.currentselect._onMouseDown(self.activelayer.currentselect, x, y)
|
self.activelayer.currentselect._onMouseDown(self.activelayer.currentselect, x, y)
|
||||||
else:
|
else:
|
||||||
if MODE in [" ", "s", "b"]:
|
if MODE in [" ", "s", "b"]:
|
||||||
|
test = False
|
||||||
for i in reversed(self.currentFrame()):
|
for i in reversed(self.currentFrame()):
|
||||||
test = False
|
|
||||||
if i.hitTest(x, y):
|
if i.hitTest(x, y):
|
||||||
if MODE in [" ", "s"]:
|
if MODE in [" ", "s"]:
|
||||||
self.activelayer.currentselect = i
|
self.activelayer.currentselect = i
|
||||||
|
|
@ -1876,9 +1886,13 @@ class ColorSelectionWindow:
|
||||||
def onClickRectFill(self,x,y):
|
def onClickRectFill(self,x,y):
|
||||||
global FILLCOLOR
|
global FILLCOLOR
|
||||||
FILLCOLOR = Color(colors.colorArray(int(x/16))[int(y/16)])
|
FILLCOLOR = Color(colors.colorArray(int(x/16))[int(y/16)])
|
||||||
|
self.window.destroy()
|
||||||
|
raise ObjectDeletedError
|
||||||
def onClickRectLine(self,x,y):
|
def onClickRectLine(self,x,y):
|
||||||
global LINECOLOR
|
global LINECOLOR
|
||||||
LINECOLOR = Color(colors.colorArray(int(x/16))[int(y/16)])
|
LINECOLOR = Color(colors.colorArray(int(x/16))[int(y/16)])
|
||||||
|
self.window.destroy()
|
||||||
|
raise ObjectDeletedError
|
||||||
canvas = Canvas(336,208)
|
canvas = Canvas(336,208)
|
||||||
group = Group()
|
group = Group()
|
||||||
def dummy(*args):
|
def dummy(*args):
|
||||||
|
|
@ -1887,6 +1901,8 @@ class ColorSelectionWindow:
|
||||||
canvas.add(group,0,0)
|
canvas.add(group,0,0)
|
||||||
im = Image("media/colors.png")
|
im = Image("media/colors.png")
|
||||||
group.add(im)
|
group.add(im)
|
||||||
|
group.window = win
|
||||||
|
group.canvas = canvas
|
||||||
if var=="fill":
|
if var=="fill":
|
||||||
group.onMouseDown = onClickRectFill
|
group.onMouseDown = onClickRectFill
|
||||||
if var=="line":
|
if var=="line":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue