Color selection possible
This commit is contained in:
parent
b2d86b8181
commit
37bd127888
|
|
@ -217,6 +217,8 @@ class MainWindowOSX:
|
||||||
self.toolbox.buttons[3][1].onPress = paintbrush
|
self.toolbox.buttons[3][1].onPress = paintbrush
|
||||||
self.toolbox.buttons[4][0].onPress = pen
|
self.toolbox.buttons[4][0].onPress = pen
|
||||||
self.toolbox.buttons[4][1].onPress = paint_bucket
|
self.toolbox.buttons[4][1].onPress = paint_bucket
|
||||||
|
self.toolbox.buttons[5][0].onPress = lambda self1: svlgui.ColorSelectionWindow("line")#,linegroup)#,self.linecanvas)
|
||||||
|
self.toolbox.buttons[5][1].onPress = lambda self1: svlgui.ColorSelectionWindow("fill")#,linegroup)#,self.fillcanvas)
|
||||||
self.scriptwindow = svlgui.TextView()
|
self.scriptwindow = svlgui.TextView()
|
||||||
self.paintgroup = svlgui.RadioGroup("Draw straight", "Draw smooth", "Draw as inked")
|
self.paintgroup = svlgui.RadioGroup("Draw straight", "Draw smooth", "Draw as inked")
|
||||||
def setmode(self):
|
def setmode(self):
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
26
svlgui.py
26
svlgui.py
|
|
@ -801,7 +801,7 @@ class TextView(Widget):
|
||||||
def mouse_down(self, event):
|
def mouse_down(self, event):
|
||||||
self.become_target()
|
self.become_target()
|
||||||
self.box = OSXTextEditor(scrolling="hv")
|
self.box = OSXTextEditor(scrolling="hv")
|
||||||
self.box.font = Font("Mono", 12, [])
|
self.box.font = Font("Courier", 12, [])
|
||||||
if width and height:
|
if width and height:
|
||||||
self.box.size = (width, height)
|
self.box.size = (width, height)
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
|
|
@ -1818,7 +1818,7 @@ class OverlayWindow:
|
||||||
|
|
||||||
|
|
||||||
class ColorSelectionWindow:
|
class ColorSelectionWindow:
|
||||||
def __init__(self,var,dispgrp, dcanv):
|
def __init__(self,var,dispgrp=None, dcanv=None):
|
||||||
if SYSTEM=="gtk":
|
if SYSTEM=="gtk":
|
||||||
win = gtk.Window()
|
win = gtk.Window()
|
||||||
win.set_size_request(320,208)
|
win.set_size_request(320,208)
|
||||||
|
|
@ -1862,6 +1862,28 @@ class ColorSelectionWindow:
|
||||||
win.connect("button-press-event", close, dispgrp, dcanv)
|
win.connect("button-press-event", close, dispgrp, dcanv)
|
||||||
win.set_modal(True)
|
win.set_modal(True)
|
||||||
win.present()
|
win.present()
|
||||||
|
elif SYSTEM=="osx":
|
||||||
|
win = OSXWindow(width=352,height=226,resizable=False)
|
||||||
|
def onClickRectFill(self,x,y):
|
||||||
|
global FILLCOLOR
|
||||||
|
FILLCOLOR = Color(colors.colorArray(int(x/16))[int(y/16)])
|
||||||
|
def onClickRectLine(self,x,y):
|
||||||
|
global LINECOLOR
|
||||||
|
LINECOLOR = Color(colors.colorArray(int(x/16))[int(y/16)])
|
||||||
|
canvas = Canvas(336,208)
|
||||||
|
group = Group()
|
||||||
|
def dummy(*args):
|
||||||
|
pass
|
||||||
|
group._onMouseMove = dummy
|
||||||
|
canvas.add(group,0,0)
|
||||||
|
im = Image("media/colors.png")
|
||||||
|
group.add(im)
|
||||||
|
if var=="fill":
|
||||||
|
group.onMouseDown = onClickRectFill
|
||||||
|
if var=="line":
|
||||||
|
group.onMouseDown = onClickRectLine
|
||||||
|
win.place(canvas._int(),left=0,top=0,right=0,bottom=0,sticky="news",scrolling="")
|
||||||
|
win.show()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#Executes the main loop for whatever GUI is running
|
#Executes the main loop for whatever GUI is running
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue