From d2a1640a6be72ec38f12ddccbc58fe61b3c81a6d Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Tue, 17 Jan 2012 10:40:57 -0500 Subject: [PATCH] Images now more working-y --- lightningbeam.py | 2 +- svlgui.py | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lightningbeam.py b/lightningbeam.py index 59e2e18..4ed4d38 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -9,7 +9,7 @@ import os, shutil #import objc, AppKit, cPickle #Uncomment to build on Windows -import ctypes, ctypes.wintypes, win32print +#import ctypes, ctypes.wintypes, win32print #SVLGUI - my custom GUI wrapper to abstract the GUI import svlgui diff --git a/svlgui.py b/svlgui.py index 6cfafef..de1af55 100644 --- a/svlgui.py +++ b/svlgui.py @@ -960,7 +960,7 @@ class Image(object): self.image.draw(cr, src_rect, dst_rect) else: src_rect = self.image.bounds - dst_rect = src_rect + dst_rect = [self.x,self.y,self.x+src_rect[2],self.y+src_rect[3]] self.image.draw(cr, src_rect, dst_rect) cr.grestore() elif SYSTEM=="html": @@ -1755,6 +1755,12 @@ class Group (object): for i in self.layers: frame = max(frame, len(i.frames)) return frame + def hitTest(self,x,y): + for i in self.layers: + for j in i.frames[0].objs: + if i.hitTest(x, y): + return True + return False def print_sc(self): retval = "" #for i in self.layers: @@ -1884,7 +1890,12 @@ def file_dialog(mode="open",default=None,types=None,multiple=False): return FileDialogs.request_new_file(default_dir=default,file_type=types) def execute(command): - os.system(command.replace("/",sep)) + rv = os.system(command.replace("/",sep)) + if PLATFORM == "osx": + if rv==0: + return True + else: + return False class OverlayWindow: if SYSTEM=="gtk": @@ -1979,18 +1990,19 @@ class ColorSelectionWindow: win.set_modal(True) win.present() elif SYSTEM=="osx": - win = OSXWindow(width=352,height=226,resizable=False) + win = ModalDialog(width=336,height=208,resizable=False) def onClickRectFill(self,x,y): global FILLCOLOR FILLCOLOR = Color(colors.colorArray(int(x/16))[int(y/16)]) - self.window.destroy() + self.window.dismiss() raise ObjectDeletedError def onClickRectLine(self,x,y): global LINECOLOR LINECOLOR = Color(colors.colorArray(int(x/16))[int(y/16)]) - self.window.destroy() + self.window.dismiss() raise ObjectDeletedError canvas = Canvas(336,208) + canvas._int().scrolling = '' group = Group(skipl=True) def dummy(*args): pass @@ -2005,7 +2017,7 @@ class ColorSelectionWindow: if var=="line": group.onMouseDown = onClickRectLine win.place(canvas._int(),left=0,top=0,right=0,bottom=0,sticky="news",scrolling="") - win.show() + win.present() class PreferencesWindow: def __init__(self):