Example #1
0
 def update_cursor(self):
     # Callback for updating the cursor
     if not self.get_mapped():
         return
     window = self.get_window()
     app = self.app
     if window is None:
         logger.error("update_cursor: no window")
         return
     override_cursor = self._override_cursor
     layer = self.doc._layers.current
     if override_cursor is not None:
         c = override_cursor
     elif self.get_state() == gtk.STATE_INSENSITIVE:
         c = None
     elif self.doc is None:
         logger.error("update_cursor: no document")
         return
     elif layer.locked or not layer.visible or not layer.get_paintable():
         # Cursor to represent that one cannot draw.
         # Often a red circle with a diagonal bar through it.
         c = gdk.Cursor(gdk.CIRCLE)
     elif app is None:
         logger.error("update_cursor: no app")
         return
     # Last two cases only pertain to FreehandMode cursors.
     # XXX refactor: bad for separation of responsibilities, put the
     # special cases in the mode class.
     elif app.preferences.get("cursor.freehand.style", None) == 'crosshair':
         c = app.cursors.get_freehand_cursor()
     else:
         radius, style = self._get_cursor_info()
         c = cursor.get_brush_cursor(radius, style, self.app.preferences)
     window.set_cursor(c)
Example #2
0
 def update_cursor(self):
     if not self.window:
         return
     elif self.override_cursor is not None:
         c = self.override_cursor
     elif not self.is_sensitive:
         c = None
     elif self.doc.layer.locked or not self.doc.layer.visible:
         c = self.CANNOT_DRAW_CURSOR
     else:
         b = self.doc.brush.brushinfo
         radius = b.get_effective_radius()*self.scale
         c = cursor.get_brush_cursor(radius, b.is_eraser(), b.get_base_value('lock_alpha') > 0.9)
     self.window.set_cursor(c)
 def update_cursor(self):
     if not self.window:
         return
     elif self.override_cursor is not None:
         c = self.override_cursor
     elif not self.is_sensitive:
         c = None
     elif self.doc.layer.locked or not self.doc.layer.visible:
         c = self.CANNOT_DRAW_CURSOR
     else:
         b = self.doc.brush.brushinfo
         radius = b.get_effective_radius() * self.scale
         c = cursor.get_brush_cursor(radius, b.is_eraser(),
                                     b.get_base_value('lock_alpha') > 0.9)
     self.window.set_cursor(c)
Example #4
0
 def update_cursor(self):
     # Callback for updating the cursor
     window = self.get_window()
     if window is None:
         return
     override_cursor = getattr(self, '_override_cursor', None)
     if override_cursor is not None:
         c = self._override_cursor
     elif self.get_state() == gtk.STATE_INSENSITIVE:
         c = None
     elif self.doc.layer.locked or not self.doc.layer.visible:
         # Cursor to represent that one cannot draw.
         # Often a red circle with a diagonal bar through it.
         c = gdk.Cursor(gdk.CIRCLE)
     else:
         radius, style = self._get_cursor_info()
         c = cursor.get_brush_cursor(radius, style, self.app.preferences)
     window.set_cursor(c)