Package peppy :: Package lib :: Module bitmapscroller :: Class BitmapScroller
[frames] | no frames]

Class BitmapScroller

     object --+                    
              |                    
wx._core.Object --+                
                  |                
wx._core.EvtHandler --+            
                      |            
        wx._core.Window --+        
                          |        
          wx._windows.Panel --+    
                              |    
     wx._windows.ScrolledWindow --+
                                  |
                                 BitmapScroller
Known Subclasses:

Instance Methods
EvtHandler
__init__(self, parent, selector=<class 'peppy.lib.bitmapscroller.Crosshair'>)
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition, ...
 
zoomIn(self, zoom=2)
 
zoomOut(self, zoom=2)
 
inOrigImage(self, x, y)
 
setImage(self, img=None, zoom=None, rot=None, vmirror=False, hmirror=False, crop=None)
Sets the control to contain a new image.
 
setBitmap(self, bmp=None, zoom=None)
Set the control to display a new bitmap.
 
setCrop(self, crop=None)
Set the image cropping.
 
copyToClipboard(self)
Copies current image to clipboard.
 
convertEventCoords(self, ev)
Convert event coordinates to world coordinates.
 
getBoundedCoords(self, x, y)
Return image coordinates clipped to boundary of image.
 
getImageCoords(self, x, y, fixbounds=True)
Convert scrolled window coordinates to image coordinates.
 
isInBounds(self, x, y)
Check if world coordinates are on the image.
 
isEventInClientArea(self, ev)
Check if event is in the viewport.
 
setCursor(self, cursor)
Set cursor for the window.
 
blankCursor(self, ev, coords=None)
Turn off cursor.
 
getSelectorCoordsOnImage(self, with_cropped_offset=True)
 
autoScroll(self, ev)
 
autoScrollCallback(self, dx, dy)
 
setSelector(self, selector)
 
startSelector(self, ev=None)
 
getActiveSelector(self)
Returns the currently active selector.
 
endActiveSelector(self)
 
OnMouseEvent(self, ev)
Driver to process mouse events.
 
OnPaint(self, evt)
 
OnPaintHook(self, evt, dc)
Hook to draw any additional items onto the saved bitmap.

Inherited from wx._windows.ScrolledWindow: AdjustScrollbars, CalcScrollInc, CalcScrolledPosition, CalcUnscrolledPosition, Create, DoPrepareDC, EnableScrolling, GetScaleX, GetScaleY, GetScrollPageSize, GetScrollPixelsPerUnit, GetTargetWindow, GetViewStart, Scroll, SetScale, SetScrollPageSize, SetScrollRate, SetScrollbars, SetTargetWindow, __repr__

Inherited from wx._windows.Panel: SetFocusIgnoringChildren

Inherited from wx._core.Window: AcceptsFocus, AcceptsFocusFromKeyboard, AddChild, AdjustForLayoutDirection, AssociateHandle, CacheBestSize, CanSetTransparent, CaptureMouse, Center, CenterOnParent, Centre, CentreOnParent, ClearBackground, ClientToScreen, ClientToScreenXY, Close, ConvertDialogPointToPixels, ConvertDialogSizeToPixels, ConvertPixelPointToDialog, ConvertPixelSizeToDialog, DLG_PNT, DLG_SZE, Destroy, DestroyChildren, Disable, DissociateHandle, DragAcceptFiles, Enable, FindWindowById, FindWindowByName, Fit, FitInside, Freeze, GetAcceleratorTable, GetAdjustedBestSize, GetAutoLayout, GetBackgroundColour, GetBackgroundStyle, GetBestFittingSize, GetBestSize, GetBestSizeTuple, GetBestVirtualSize, GetBorder, GetCaret, GetCharHeight, GetCharWidth, GetChildren, GetClientAreaOrigin, GetClientRect, GetClientSize, GetClientSizeTuple, GetConstraints, GetContainingSizer, GetCursor, GetDefaultAttributes, GetDropTarget, GetEffectiveMinSize, GetEventHandler, GetExtraStyle, GetFont, GetForegroundColour, GetFullTextExtent, GetGrandParent, GetGtkWidget, GetHandle, GetHelpText, GetHelpTextAtPoint, GetId, GetLabel, GetLayoutDirection, GetMaxHeight, GetMaxSize, GetMaxWidth, GetMinHeight, GetMinSize, GetMinWidth, GetName, GetParent, GetPosition, GetPositionTuple, GetRect, GetScreenPosition, GetScreenPositionTuple, GetScreenRect, GetScrollPos, GetScrollRange, GetScrollThumb, GetSize, GetSizeTuple, GetSizer, GetTextExtent, GetThemeEnabled, GetToolTip, GetTopLevelParent, GetUpdateClientRect, GetUpdateRegion, GetValidator, GetVirtualSize, GetVirtualSizeTuple, GetWindowBorderSize, GetWindowStyle, GetWindowStyleFlag, GetWindowVariant, HasCapture, HasFlag, HasMultiplePages, HasScrollbar, HasTransparentBackground, Hide, HitTest, HitTestXY, InheritAttributes, InheritsBackgroundColour, InitDialog, InvalidateBestSize, IsBeingDeleted, IsDoubleBuffered, IsEnabled, IsExposed, IsExposedPoint, IsExposedRect, IsFrozen, IsRetained, IsShown, IsShownOnScreen, IsTopLevel, Layout, LineDown, LineUp, Lower, MakeModal, Move, MoveAfterInTabOrder, MoveBeforeInTabOrder, MoveXY, Navigate, PageDown, PageUp, PopEventHandler, PopupMenu, PopupMenuXY, PostCreate, PrepareDC, PushEventHandler, Raise, Refresh, RefreshRect, RegisterHotKey, ReleaseMouse, RemoveChild, RemoveEventHandler, Reparent, ScreenToClient, ScreenToClientXY, ScrollLines, ScrollPages, ScrollWindow, SendSizeEvent, SetAcceleratorTable, SetAutoLayout, SetBackgroundColour, SetBackgroundStyle, SetBestFittingSize, SetCaret, SetClientRect, SetClientSize, SetClientSizeWH, SetConstraints, SetContainingSizer, SetCursor, SetDimensions, SetDoubleBuffered, SetDropTarget, SetEventHandler, SetExtraStyle, SetFocus, SetFocusFromKbd, SetFont, SetForegroundColour, SetHelpText, SetHelpTextForId, SetId, SetInitialSize, SetLabel, SetLayoutDirection, SetMaxSize, SetMinSize, SetName, SetOwnBackgroundColour, SetOwnFont, SetOwnForegroundColour, SetPosition, SetRect, SetScrollPos, SetScrollbar, SetSize, SetSizeHints, SetSizeHintsSz, SetSizeWH, SetSizer, SetSizerAndFit, SetThemeEnabled, SetToolTip, SetToolTipString, SetTransparent, SetValidator, SetVirtualSize, SetVirtualSizeHints, SetVirtualSizeHintsSz, SetVirtualSizeWH, SetWindowStyle, SetWindowStyleFlag, SetWindowVariant, ShouldInheritColours, Show, Thaw, ToggleWindowStyle, TransferDataFromWindow, TransferDataToWindow, UnregisterHotKey, Update, UpdateWindowUI, UseBgCol, Validate, WarpPointer

Inherited from wx._core.EvtHandler: AddPendingEvent, Bind, Connect, Disconnect, GetEvtHandlerEnabled, GetNextHandler, GetPreviousHandler, ProcessEvent, ProcessPendingEvents, SetEvtHandlerEnabled, SetNextHandler, SetPreviousHandler, Unbind

Inherited from wx._core.Object: GetClassName, IsSameAs

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Static Methods

Inherited from wx._windows.ScrolledWindow: GetClassDefaultAttributes

Inherited from wx._core.Window: FindFocus, GetCapture, NewControlId, NextControlId, PrevControlId

Class Variables
  dbg_call_seq = 0
Properties

Inherited from wx._windows.ScrolledWindow: ScaleX, ScaleY, TargetWindow, ViewStart, thisown

Inherited from wx._core.Window: AcceleratorTable, AutoLayout, BackgroundColour, BackgroundStyle, BestSize, BestVirtualSize, Border, Caret, CharHeight, CharWidth, Children, ClientAreaOrigin, ClientRect, ClientSize, Constraints, ContainingSizer, Cursor, DefaultAttributes, DropTarget, EffectiveMinSize, Enabled, EventHandler, ExtraStyle, Font, ForegroundColour, GrandParent, GtkWidget, Handle, HelpText, Id, Label, LayoutDirection, MaxHeight, MaxSize, MaxWidth, MinHeight, MinSize, MinWidth, Name, Parent, Position, Rect, ScreenPosition, ScreenRect, Shown, Size, Sizer, ThemeEnabled, ToolTip, TopLevel, TopLevelParent, UpdateClientRect, UpdateRegion, Validator, VirtualSize, WindowStyle, WindowStyleFlag, WindowVariant

Inherited from wx._core.EvtHandler: EvtHandlerEnabled, NextHandler, PreviousHandler

Inherited from wx._core.Object: ClassName

Inherited from object: __class__

Method Details

__init__(self, parent, selector=<class 'peppy.lib.bitmapscroller.Crosshair'>)
(Constructor)

 

__init__(self, Window parent, int id=-1, Point pos=DefaultPosition, 
    Size size=DefaultSize, long style=wxHSCROLL|wxVSCROLL, 
    String name=PanelNameStr) -> ScrolledWindow

Returns: EvtHandler
Overrides: object.__init__
(inherited documentation)

setImage(self, img=None, zoom=None, rot=None, vmirror=False, hmirror=False, crop=None)

 

Sets the control to contain a new image.

Main user interaction with this control -- makes the control display a new image, discarding the old image.

Parameters:
  • img - new wx.Image to display
  • zoom - optional floating point zoom factor
  • rot - not working yet
  • vmirror - not working yet
  • hmirror - not working yet
  • crop - None for no cropping, or (x, y, w, h) tuple

setBitmap(self, bmp=None, zoom=None)

 

Set the control to display a new bitmap.

Similar to setImage, but takes a wx.Bitmap instead of a wx.Image.

setCrop(self, crop=None)

 

Set the image cropping.

Crops the image to the specified size. If crop is an (x, y, w, h) tuple, it crops the image as specified. If crop is None, it restores the original image.

copyToClipboard(self)

 

Copies current image to clipboard.

Copies the current image, including scaling, zooming, etc. to the clipboard.

convertEventCoords(self, ev)

 

Convert event coordinates to world coordinates.

Convert the event coordinates to world coordinates by locating the offset of the scrolled window's viewport and adjusting the event coordinates.

getImageCoords(self, x, y, fixbounds=True)

 

Convert scrolled window coordinates to image coordinates.

Convert from the scrolled window coordinates (where (0,0) is the upper left corner when the window is scrolled to the top-leftmost position) to the corresponding point on the original (i.e. unzoomed, unrotated, uncropped) image.

isInBounds(self, x, y)

 

Check if world coordinates are on the image.

Return True if the world coordinates lie on the image.

isEventInClientArea(self, ev)

 

Check if event is in the viewport.

Return True if the event is within the visible viewport of the scrolled window.

setCursor(self, cursor)

 

Set cursor for the window.

A mild enhancement of the wx standard SetCursor that takes an integer id as well as a wx.StockCursor instance.

blankCursor(self, ev, coords=None)

 

Turn off cursor.

Some selectors, like the crosshair selector, work better when the mouse cursor isn't obscuring the image. This method is called by the selector itself to blank the cursor when over the image.

OnMouseEvent(self, ev)

 

Driver to process mouse events.

This is the main driver to process all mouse events that happen on the BitmapScroller. Once a selector is triggered by its event combination, it becomes the active selector and further mouse events are directed to its handler.

OnPaintHook(self, evt, dc)

 

Hook to draw any additional items onto the saved bitmap.

Note that any changes made to the dc will be reflected in the saved bitmap, so subsequent times calling this function will continue to add new data to the image.