Giter Site home page Giter Site logo

tsn-admin / wxpystc_docmap Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 3.21 MB

Document map (aka minimap) for wx.stc.StyledTextCtrl editor control

License: MIT License

Python 100.00%
python3 wxpython4 scintilla styledtextctrl document map minimap wxpython

wxpystc_docmap's People

Contributors

tsn-admin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wxpystc_docmap's Issues

Critique

For a first-pass at the code, I would like to say you have done a good job. :)

There are a few things that don't quite work as I would expect.

  1. Dragging on the minimap and moving the mouse outside the minimap doesnt scroll properly like I've seen other implementations of a minimap do.(either dragging up or down the document)

  2. This should be changed self.SetDoubleBuffered(True)
    to

if not self.IsDoubleBuffered():
    self.SetDoubleBuffered(True)

Robin states that some platforms are already DoubleBuffered by default, and doing it without a check would x4 or in otherwords make performance worse.

  1. I see double loops often enough that a local opt list comprehension will definitely run faster since the method is pushing into C when dealing with all pixels.
    def SetTransparency(self, alpha=0x80):
        img = self.bmp.ConvertToImage()
        if not img.HasAlpha():
            img.InitAlpha()
            for x in range(img.Width):
                for y in range(img.Height):
                    img.SetAlpha(x, y, alpha)
            self.bmp = img.ConvertToBitmap()

would run faster as

    def SetTransparency(self, alpha=0x80):
        img = self.bmp.ConvertToImage()
        if not img.HasAlpha():
            img.InitAlpha()
        width, height = img.Width, img.Height
        SetAlpha = img.SetAlpha
        [SetAlpha(x, y, alpha)
            for y in range(height)
                for x in range(width)]
        self.bmp = img.ConvertToBitmap()
  1. As far as the #INFO, Class with too many parameters: better design strategy?, I personally will put all that stuff with the defaults in the class constructor, so it shows up when you request a calltip, but am not sure if that really should be written another way. I would assume most folks would only use 1 minimap, but I wouldnt rule out someone using it with dynamic sash or multisash type of setup.

I think that's all I see at the moment. Thanks for spending the time to code this thing up! I always had it on my list of widgets to implement, but never seemed to get the time to code one up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.