Added patched PyGUI folder - needs work
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
run dist/blobedit.app/Contents/MacOS/blobedit
|
||||
where
|
||||
q
|
||||
@@ -0,0 +1,2 @@
|
||||
app:
|
||||
python setup.py py2app
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,73 @@
|
||||
(lp0
|
||||
(i__main__
|
||||
Blob
|
||||
p1
|
||||
(dp2
|
||||
S'rect'
|
||||
p3
|
||||
(F40.0
|
||||
F16.0
|
||||
F80.0
|
||||
F56.0
|
||||
tp4
|
||||
sba(i__main__
|
||||
Blob
|
||||
p5
|
||||
(dp6
|
||||
g3
|
||||
(F77.0
|
||||
F89.0
|
||||
F117.0
|
||||
F129.0
|
||||
tp7
|
||||
sba(i__main__
|
||||
Blob
|
||||
p8
|
||||
(dp9
|
||||
g3
|
||||
(F182.0
|
||||
F53.0
|
||||
F222.0
|
||||
F93.0
|
||||
tp10
|
||||
sba(i__main__
|
||||
Blob
|
||||
p11
|
||||
(dp12
|
||||
g3
|
||||
(F98.0
|
||||
F206.0
|
||||
F138.0
|
||||
F246.0
|
||||
tp13
|
||||
sba(i__main__
|
||||
Blob
|
||||
p14
|
||||
(dp15
|
||||
g3
|
||||
(F200.0
|
||||
F147.0
|
||||
F240.0
|
||||
F187.0
|
||||
tp16
|
||||
sba(i__main__
|
||||
Blob
|
||||
p17
|
||||
(dp18
|
||||
g3
|
||||
(F219.0
|
||||
F251.0
|
||||
F259.0
|
||||
F291.0
|
||||
tp19
|
||||
sba(i__main__
|
||||
Blob
|
||||
p20
|
||||
(dp21
|
||||
g3
|
||||
(F310.0
|
||||
F194.0
|
||||
F350.0
|
||||
F234.0
|
||||
tp22
|
||||
sba.
|
||||
@@ -0,0 +1,73 @@
|
||||
(lp0
|
||||
(i__main__
|
||||
Blob
|
||||
p1
|
||||
(dp2
|
||||
S'rect'
|
||||
p3
|
||||
(I55
|
||||
I71
|
||||
I95
|
||||
I111
|
||||
tp4
|
||||
sba(i__main__
|
||||
Blob
|
||||
p5
|
||||
(dp6
|
||||
g3
|
||||
(I245
|
||||
I71
|
||||
I285
|
||||
I111
|
||||
tp7
|
||||
sba(i__main__
|
||||
Blob
|
||||
p8
|
||||
(dp9
|
||||
g3
|
||||
(F150.0
|
||||
F181.0
|
||||
F190.0
|
||||
F221.0
|
||||
tp10
|
||||
sba(i__main__
|
||||
Blob
|
||||
p11
|
||||
(dp12
|
||||
g3
|
||||
(F119.0
|
||||
F198.0
|
||||
F159.0
|
||||
F238.0
|
||||
tp13
|
||||
sba(i__main__
|
||||
Blob
|
||||
p14
|
||||
(dp15
|
||||
g3
|
||||
(F189.0
|
||||
F202.0
|
||||
F229.0
|
||||
F242.0
|
||||
tp16
|
||||
sba(i__main__
|
||||
Blob
|
||||
p17
|
||||
(dp18
|
||||
g3
|
||||
(I230
|
||||
I225
|
||||
I270
|
||||
I265
|
||||
tp19
|
||||
sba(i__main__
|
||||
Blob
|
||||
p20
|
||||
(dp21
|
||||
g3
|
||||
(I73
|
||||
I224
|
||||
I113
|
||||
I264
|
||||
tp22
|
||||
sba.
|
||||
@@ -0,0 +1,73 @@
|
||||
(lp0
|
||||
(i__main__
|
||||
Blob
|
||||
p1
|
||||
(dp2
|
||||
S'rect'
|
||||
p3
|
||||
(F239.0
|
||||
F101.0
|
||||
F279.0
|
||||
F141.0
|
||||
tp4
|
||||
sba(i__main__
|
||||
Blob
|
||||
p5
|
||||
(dp6
|
||||
g3
|
||||
(F171.0
|
||||
F45.0
|
||||
F211.0
|
||||
F85.0
|
||||
tp7
|
||||
sba(i__main__
|
||||
Blob
|
||||
p8
|
||||
(dp9
|
||||
g3
|
||||
(F193.0
|
||||
F58.0
|
||||
F233.0
|
||||
F98.0
|
||||
tp10
|
||||
sba(i__main__
|
||||
Blob
|
||||
p11
|
||||
(dp12
|
||||
g3
|
||||
(F216.0
|
||||
F78.0
|
||||
F256.0
|
||||
F118.0
|
||||
tp13
|
||||
sba(i__main__
|
||||
Blob
|
||||
p14
|
||||
(dp15
|
||||
g3
|
||||
(F259.0
|
||||
F123.0
|
||||
F299.0
|
||||
F163.0
|
||||
tp16
|
||||
sba(i__main__
|
||||
Blob
|
||||
p17
|
||||
(dp18
|
||||
g3
|
||||
(F282.0
|
||||
F151.0
|
||||
F322.0
|
||||
F191.0
|
||||
tp19
|
||||
sba(i__main__
|
||||
Blob
|
||||
p20
|
||||
(dp21
|
||||
g3
|
||||
(F307.0
|
||||
F176.0
|
||||
F347.0
|
||||
F216.0
|
||||
tp22
|
||||
sba.
|
||||
@@ -0,0 +1,73 @@
|
||||
(lp0
|
||||
(i__main__
|
||||
Blob
|
||||
p1
|
||||
(dp2
|
||||
S'rect'
|
||||
p3
|
||||
(I55
|
||||
I71
|
||||
I95
|
||||
I111
|
||||
tp4
|
||||
sba(i__main__
|
||||
Blob
|
||||
p5
|
||||
(dp6
|
||||
g3
|
||||
(I245
|
||||
I71
|
||||
I285
|
||||
I111
|
||||
tp7
|
||||
sba(i__main__
|
||||
Blob
|
||||
p8
|
||||
(dp9
|
||||
g3
|
||||
(I153
|
||||
I272
|
||||
I193
|
||||
I312
|
||||
tp10
|
||||
sba(i__main__
|
||||
Blob
|
||||
p11
|
||||
(dp12
|
||||
g3
|
||||
(I107
|
||||
I258
|
||||
I147
|
||||
I298
|
||||
tp13
|
||||
sba(i__main__
|
||||
Blob
|
||||
p14
|
||||
(dp15
|
||||
g3
|
||||
(I194
|
||||
I257
|
||||
I234
|
||||
I297
|
||||
tp16
|
||||
sba(i__main__
|
||||
Blob
|
||||
p17
|
||||
(dp18
|
||||
g3
|
||||
(I230
|
||||
I225
|
||||
I270
|
||||
I265
|
||||
tp19
|
||||
sba(i__main__
|
||||
Blob
|
||||
p20
|
||||
(dp21
|
||||
g3
|
||||
(I73
|
||||
I224
|
||||
I113
|
||||
I264
|
||||
tp22
|
||||
sba.
|
||||
@@ -0,0 +1,132 @@
|
||||
#
|
||||
# BlobEdit - A totally silly application for showing
|
||||
# ======== off the GUI framework and providing an example
|
||||
# of its use.
|
||||
#
|
||||
# Blobs are red squares that you place on a Blob Document
|
||||
# by clicking and move around by dragging. You can save
|
||||
# your blob arrangement in a file and load it back later
|
||||
# to impress your friends (or send them away screaming).
|
||||
#
|
||||
# News flash: Got a blob you don't want? Now you can
|
||||
# get rid of it by shift-clicking it! Isn't that useful!
|
||||
#
|
||||
|
||||
import pickle
|
||||
from GUI import Application, ScrollableView, Document, Window, Cursor, rgb
|
||||
from GUI.Files import FileType
|
||||
from GUI.Geometry import pt_in_rect, offset_rect, rects_intersect
|
||||
from GUI.StdColors import black, red
|
||||
|
||||
|
||||
class BlobApp(Application):
|
||||
|
||||
def __init__(self):
|
||||
Application.__init__(self)
|
||||
self.blob_type = FileType(name = "Blob Document", suffix = "blob",
|
||||
#mac_creator = "BLBE", mac_type = "BLOB", # These are optional
|
||||
)
|
||||
self.file_type = self.blob_type
|
||||
self.blob_cursor = Cursor("blob.tiff")
|
||||
|
||||
def open_app(self):
|
||||
self.new_cmd()
|
||||
|
||||
def make_document(self, fileref):
|
||||
return BlobDoc(file_type = self.blob_type)
|
||||
|
||||
def make_window(self, document):
|
||||
win = Window(size = (400, 400), document = document)
|
||||
view = BlobView(model = document, extent = (1000, 1000), scrolling = 'hv',
|
||||
cursor = self.blob_cursor)
|
||||
win.place(view, left = 0, top = 0, right = 0, bottom = 0, sticky = 'nsew')
|
||||
win.show()
|
||||
|
||||
|
||||
class BlobView(ScrollableView):
|
||||
|
||||
def draw(self, canvas, update_rect):
|
||||
canvas.erase_rect(update_rect)
|
||||
canvas.fillcolor = red
|
||||
canvas.pencolor = black
|
||||
for blob in self.model.blobs:
|
||||
if blob.intersects(update_rect):
|
||||
blob.draw(canvas)
|
||||
|
||||
def mouse_down(self, event):
|
||||
x, y = event.position
|
||||
blob = self.model.find_blob(x, y)
|
||||
if blob:
|
||||
if not event.shift:
|
||||
self.drag_blob(blob, x, y)
|
||||
else:
|
||||
self.model.delete_blob(blob)
|
||||
else:
|
||||
self.model.add_blob(Blob(x, y))
|
||||
|
||||
def drag_blob(self, blob, x0, y0):
|
||||
for event in self.track_mouse():
|
||||
x, y = event.position
|
||||
self.model.move_blob(blob, x - x0, y - y0)
|
||||
x0 = x
|
||||
y0 = y
|
||||
|
||||
def blob_changed(self, model, blob):
|
||||
self.invalidate_rect((0,0,self.extent[0],self.extent[1]))
|
||||
|
||||
|
||||
class BlobDoc(Document):
|
||||
|
||||
blobs = None
|
||||
|
||||
def new_contents(self):
|
||||
self.blobs = []
|
||||
|
||||
def read_contents(self, file):
|
||||
self.blobs = pickle.load(file)
|
||||
|
||||
def write_contents(self, file):
|
||||
pickle.dump(self.blobs, file)
|
||||
|
||||
def add_blob(self, blob):
|
||||
self.blobs.append(blob)
|
||||
self.changed()
|
||||
self.notify_views('blob_changed', blob)
|
||||
|
||||
def find_blob(self, x, y):
|
||||
for blob in self.blobs:
|
||||
if blob.contains(x, y):
|
||||
return blob
|
||||
return None
|
||||
|
||||
def move_blob(self, blob, dx, dy):
|
||||
self.notify_views('blob_changed', blob)
|
||||
blob.move(dx, dy)
|
||||
self.changed()
|
||||
self.notify_views('blob_changed', blob)
|
||||
|
||||
def delete_blob(self, blob):
|
||||
self.notify_views('blob_changed', blob)
|
||||
self.blobs.remove(blob)
|
||||
self.changed()
|
||||
|
||||
|
||||
class Blob:
|
||||
|
||||
def __init__(self, x, y):
|
||||
self.rect = (x - 20, y - 20, x + 20, y + 20)
|
||||
|
||||
def contains(self, x, y):
|
||||
return pt_in_rect((x, y), self.rect)
|
||||
|
||||
def intersects(self, rect):
|
||||
return rects_intersect(rect, self.rect)
|
||||
|
||||
def move(self, dx, dy):
|
||||
self.rect = offset_rect(self.rect, (dx, dy))
|
||||
|
||||
def draw(self, canvas):
|
||||
canvas.fill_frame_rect(self.rect)
|
||||
|
||||
|
||||
BlobApp().run()
|
||||
@@ -0,0 +1,31 @@
|
||||
import sys
|
||||
print sys.path
|
||||
|
||||
from distutils.core import setup
|
||||
import py2app
|
||||
|
||||
setup(
|
||||
app=['blobedit.py'],
|
||||
data_files=[
|
||||
'Resources/blob.tiff',
|
||||
'Resources/blob_file.icns',
|
||||
'Resources/blob_app.icns'
|
||||
],
|
||||
options = dict(
|
||||
py2app = dict(
|
||||
#includes = ['objc', 'Foundation', 'AppKit'],
|
||||
#packages = ['GUI'],
|
||||
plist = dict(
|
||||
#CFBundleSignature = "BLBE", # If you are using mac_creator
|
||||
CFBundleIconFile = "blob_app",
|
||||
CFBundleDocumentTypes = [
|
||||
dict(CFBundleTypeName = "BlobEdit Document",
|
||||
CFBundleTypeRole = "Editor",
|
||||
#CFBundleTypeOSTypes = ["BLOB"], # If you are using mac_type
|
||||
CFBundleTypeExtensions = ["blob"],
|
||||
CFBundleTypeIconFile = "blob_file",
|
||||
)]
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
from GUI import ModalDialog, Label, Button, Task, application
|
||||
|
||||
class NagBox(ModalDialog):
|
||||
|
||||
def __init__(self, text, timeout):
|
||||
ModalDialog.__init__(self)
|
||||
label = Label(text)
|
||||
self.ok_button = Button("OK", action = "ok", enabled = False)
|
||||
self.place(label, left = 20, top = 20)
|
||||
self.place(self.ok_button, top = label + 20, right = label.right)
|
||||
self.shrink_wrap(padding = (20, 20))
|
||||
self.timer = Task(self.enable_button, timeout)
|
||||
|
||||
def enable_button(self):
|
||||
self.ok_button.enabled = True
|
||||
|
||||
def ok(self):
|
||||
self.dismiss(True)
|
||||
|
||||
|
||||
dlog = NagBox("Consider yourself nagged.", 10)
|
||||
dlog.present()
|
||||
Reference in New Issue
Block a user