Esempio n. 1
0
 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")
Esempio n. 2
0
    def __init__(self):
        Application.__init__(self)

        #define a file type for the app's files
        #this allows us to the app to recognize the files it can open
        self.file_type = FileType(name='Line Document', suffix='ln')

        #we can create new cursors to use in our views
        self.line_cursor = Cursor("crosshair.tiff")
Esempio n. 3
0
def test():
	file = "grail_masked.tiff"
	#file = "spam_masked.tiff"
	image = Image(os.path.join(sys.path[0], file))
	cursor = Cursor(image)
	win = Window(title = "Image Cursor", width = 500, height = 400)
	view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
	view2 = TestScrollableView(position = (140, 20), size = (200, 200),
		scrolling = 'hv')
	view2.cursor = cursor
	win.add(view1)
	win.place(view2, sticky = 'nsew')
	win.shrink_wrap((20, 20))
	win.show()
Esempio n. 4
0
#		Python GUI - Standard Cursors - Gtk
#

from gtk import gdk
from GUI import Cursor

__all__ = [
    'arrow',
    'ibeam',
    'crosshair',
    'fist',
    'hand',
    'finger',
    'invisible',
]

arrow = Cursor._from_gtk_std_cursor(gdk.LEFT_PTR)
ibeam = Cursor._from_gtk_std_cursor(gdk.XTERM)
crosshair = Cursor._from_gtk_std_cursor(gdk.TCROSS)
fist = Cursor("cursors/fist.tiff")
hand = Cursor("cursors/hand.tiff")
finger = Cursor("cursors/finger.tiff")
invisible = Cursor._from_nothing()

del gdk
del Cursor


def empty_cursor():
    return invisible
Esempio n. 5
0
    'finger',
    'invisible',
]


def win_get_std_cursor(id):
    app = ui.GetApp()
    win_app = getattr(app, '_win_app', app)
    hcursor = win_app.LoadStandardCursor(id)
    return Cursor._from_win_cursor(hcursor)


arrow = win_get_std_cursor(wc.IDC_ARROW)
ibeam = win_get_std_cursor(wc.IDC_IBEAM)
crosshair = win_get_std_cursor(wc.IDC_CROSS)
fist = Cursor("cursors/fist.tiff")
hand = Cursor("cursors/hand.tiff")
finger = win_get_std_cursor(wc.IDC_HAND)
invisible = Cursor._from_win_cursor(0)


def empty_cursor():
    return invisible


# Win32 only
wait = win_get_std_cursor(wc.IDC_WAIT)
up_arrow = win_get_std_cursor(wc.IDC_UPARROW)
size_all = win_get_std_cursor(wc.IDC_SIZEALL)
size_w_e = win_get_std_cursor(wc.IDC_SIZEWE)
size_n_s = win_get_std_cursor(wc.IDC_SIZENS)
Esempio n. 6
0
class LineView(ScrollableView):

    cursors = {
        'eraser': Cursor("eraser.tiff"),
        'crosshair': Cursor("crosshair.tiff"),
        'fist': Cursor("fist.tiff")
    }

    def draw(self, canvas, update_rect):
        canvas.erase_rect(update_rect)
        canvas.fillcolor = red
        canvas.pencolor = black
        for line in self.model.lines:
            line.draw(canvas)

    def mouse_down(self, event):

        x, y = event.position
        line = self.model.find_line(x, y)

        if event.button is 'right':
            self.delete_lines()
        elif event.control:
            if line:
                self.drag_line(line, x, y)
        elif event.shift:
            if line:
                self.copy_line(line, x, y)
        else:
            self.draw_line(x, y)

    def copy_line(self, line, x, y):
        new_line = Line(x, y)
        new_line.copy(line)
        self.model.add_line(new_line)
        self.drag_line(new_line, x, y)

    def delete_lines(self):
        self.cursor = self.cursors['eraser']
        for event in self.track_mouse():
            x, y = event.position
            line = self.model.find_line(x, y)
            if line:
                self.model.remove_line(line)
        self.cursor = self.cursors['crosshair']

    def drag_line(self, line, x0, y0):
        self.cursor = self.cursors['fist']
        for event in self.track_mouse():
            x, y = event.position
            self.model.move_line(line, x - x0, y - y0)
            x0 = x
            y0 = y
        self.cursor = self.cursors['crosshair']

    def draw_line(self, x0, y0):
        line = Line(x0, y0)
        self.model.add_line(line)
        for event in self.track_mouse():
            x, y = event.position
            self.model.change_line(line, x, y)

    def line_changed(self, model, line):
        self.invalidate_rect(line.line)
Esempio n. 7
0
 def __init__(self, simbolo):
     self.simbolo = simbolo
     self.cursor = Cursor()
     self.alphabet = Alphabet([])
     self.er = ER([], self.alphabet)
     self.all()