"Fossies" - the Fresh Open Source Software Archive

Member "photofilmstrip-3.7.0/photofilmstrip/res/cursors.py" (12 Nov 2018, 2659 Bytes) of package /linux/privat/photofilmstrip-3.7.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "cursors.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 3.5.1_vs_3.7.0.

    1 # -*- coding: utf-8 -*-
    2 #
    3 # PhotoFilmStrip - Creates movies out of your pictures.
    4 #
    5 # Copyright (C) 2008 Jens Goepfert
    6 #
    7 
    8 import wx
    9 
   10 DATA = [[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
   11         [2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 0, 0, 0, 0],
   12         [2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 2, 0, 1, 1, 0],
   13         [2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 0, 2, 0, 1, 1, 0],
   14         [2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 0, 2, 0, 1, 1, 0],
   15         [2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 0, 1, 1, 0],
   16         [2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 0],
   17         [2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 0],
   18         [2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 0],
   19         [2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 0],
   20         [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0],
   21         [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 0],
   22         [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
   23         [2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
   24         [2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
   25         [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
   26 
   27 __CURSORS = {}
   28 
   29 
   30 def __MakeCursor(data):
   31     img = wx.Image(16, 16)
   32     img.SetMaskColour(255, 0, 0)
   33     for px in range(len(data)):
   34         for py in range(len(data[px])):
   35             val = data[px][py]
   36             if val == 2:
   37                 img.SetRGB(px, py, 255, 0, 0)
   38             elif val == 1:
   39                 img.SetRGB(px, py, 0, 0, 0)
   40             elif val == 0:
   41                 img.SetRGB(px, py, 255, 255, 255)
   42     img.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 8)
   43     img.SetOption(wx.IMAGE_OPTION_CUR_HOTSPOT_Y, 8)
   44     return wx.Cursor(img)
   45 
   46 
   47 def GetNW():
   48     if 'NW' in __CURSORS:
   49         return __CURSORS['NW']
   50 
   51     result = []
   52     for line in DATA:
   53         tmp = []
   54         for value in line:
   55             tmp.insert(0, value)
   56         result.insert(0, tmp)
   57     cursor = __MakeCursor(result)
   58     __CURSORS['NW'] = cursor
   59     return cursor
   60 
   61 
   62 def GetSE():
   63     if 'SE' in __CURSORS:
   64         return __CURSORS['SE']
   65 
   66     cursor = __MakeCursor(DATA)
   67     __CURSORS['SE'] = cursor
   68     return cursor
   69 
   70 
   71 def GetSW():
   72     if 'SW' in __CURSORS:
   73         return __CURSORS['SW']
   74 
   75     result = []
   76     for line in DATA:
   77         tmp = []
   78         for value in line:
   79             tmp.append(value)
   80         result.insert(0, tmp)
   81     cursor = __MakeCursor(result)
   82     __CURSORS['SW'] = cursor
   83     return cursor
   84 
   85 
   86 def GetNE():
   87     if 'NE' in __CURSORS:
   88         return __CURSORS['NE']
   89 
   90     result = []
   91     for line in DATA:
   92         tmp = []
   93         for value in line:
   94             tmp.insert(0, value)
   95         result.append(tmp)
   96     cursor = __MakeCursor(result)
   97     __CURSORS['NE'] = cursor
   98     return cursor
   99