コード例 #1
0
ファイル: colorpicker.py プロジェクト: sjcalamia/mypaint
    def __init__(self, doc, tdw, x, y):
        """Initialize, attaching to the brush and to the tdw.

        Observer callbacks and canvas overlays are registered by this
        constructor, so cleanup() must be called when the owning mode leave()s.

        """
        Overlay.__init__(self)
        self._doc = doc
        self._tdw = tdw
        self._x = int(x) + 0.5
        self._y = int(y) + 0.5
        alloc = tdw.get_allocation()
        self._tdw_w = alloc.width
        self._tdw_h = alloc.height
        self._color = self._get_app_brush_color()
        app = doc.app
        app.brush.observers.append(self._brush_color_changed_cb)
        tdw.display_overlays.append(self)
        self._previous_area = None
        self._queue_tdw_redraw()
コード例 #2
0
ファイル: colorpicker.py プロジェクト: ShadowKyogre/mypaint
    def __init__(self, doc, tdw, x, y):
        """Initialize, attaching to the brush and to the tdw.

        Observer callbacks and canvas overlays are registered by this
        constructor, so cleanup() must be called when the owning mode leave()s.

        """
        Overlay.__init__(self)
        self._doc = doc
        self._tdw = tdw
        self._x = int(x)+0.5
        self._y = int(y)+0.5
        alloc = tdw.get_allocation()
        self._tdw_w = alloc.width
        self._tdw_h = alloc.height
        self._color = self._get_app_brush_color()
        app = doc.app
        app.brush.observers.append(self._brush_color_changed_cb)
        tdw.display_overlays.append(self)
        self._previous_area = None
        self._queue_tdw_redraw()
コード例 #3
0
ファイル: framewindow.py プロジェクト: emfol/mypaint
 def __init__(self, doc):
     """Initialize overlay"""
     Overlay.__init__(self)
     self.doc = doc
     self.app = doc.app
     self._trash_icon_pixbuf = None
コード例 #4
0
ファイル: framewindow.py プロジェクト: kleopatra999/mypaint
 def __init__(self, doc):
     """Initialize overlay"""
     Overlay.__init__(self)
     self.doc = doc
     self.app = doc.app
コード例 #5
0
ファイル: framewindow.py プロジェクト: Jehan/mypaint
 def __init__(self, doc):
     """Initialize overlay"""
     Overlay.__init__(self)
     self.doc = doc
     self.app = doc.app
     self._trash_icon_pixbuf = None
コード例 #6
0
 def __init__(self, doc):
     """Initialize overlay"""
     Overlay.__init__(self)
     self.doc = doc
     self.app = doc.app
コード例 #7
0
 def setUp(self):
     """Setup an Overlay instance as an attribute"""
     self.w = Overlay((0, 0), (100, 100), "TestOverlay")
コード例 #8
0
class TestOverlay(TestCase):
    """Execute tests on the Overlay"""
    def setUp(self):
        """Setup an Overlay instance as an attribute"""
        self.w = Overlay((0, 0), (100, 100), "TestOverlay")

    def tearDown(self):
        """Destroy the open Overlay window"""
        self.w.destroy()

    def test_update(self):
        """Test whether the overlay can update correctly"""
        self.w.update()

    def test_add_label(self):
        """Test the addition of a Label and redrawing after that"""
        i = self.w.add_label(0, "Example Label", color=(255, 255, 255))
        self.w.update()
        self.w.remove_label(i)
        self.w.update()

    def test_rectangle(self):
        """Test the Rectangle property of the Overlay"""
        r = self.w.rectangle
        self.assertIsInstance(r, tuple)
        self.assertEqual(len(r), 4)
        self.assertEqual(r, (0, 0, 100, 100))
コード例 #9
0
ファイル: example.py プロジェクト: RedFantom/python-overlays
"""
Author: RedFantom
License: GNU GPLv3
Copyright (c) 2018 RedFantom

Example showing off the available Overlay for the platform. Creates
multiple different overlays, each with different properties.
"""
from overlays import Overlay

w1 = Overlay((0, 0), (100, 100), "Overlay1")
w2 = Overlay((0, 100), (100, 100), "Overlay2")
w1.add_label(0, "Example Overlay 1", color=(255, 0, 0))
w1.add_label(1, "Second Label", color=(255, 0, 255))
w2.add_label(0,
             "Example Overlay 2",
             color=(0, 255, 255),
             font=("default", 14, True, True))
w2.add_label(1, "Second Label", image="tests/image.png")

try:
    import time
    time.sleep(30)
    raise KeyboardInterrupt()
except KeyboardInterrupt:
    w1.destroy()
    w2.destroy()
exit(0)