Just installed Trac + SVN

Posted on June 26th, 2008 by Vladiuz, under Web Development.

Now my Trac environment is fully functional. It took a while to make SVN and trac use the same authz file and combine both public and private access SVN directories. Thanks to C. Michael (Mike) Pilato’s “Authz and Anon Authn Agony” article for pointing me in the right direction.

Now I have both SVN and Trac Source browser access the same repository, and I can grant dir-based accesses to users on SVN, and they will have the same permissions in my Trac Source Browser.

I am planning to host all the the projects here. If you want to start up a wxPython module project, let me know, i can get you space in my trac/svn/wiki environment. Just email me or leave comments here.

No Comments

Flicker-free Device Context (wxDC) in wxPython

Posted on June 8th, 2008 by Vladiuz, under Python.

If you are using direct drawing to device context in wxPython, you may have noticed that constant redrawing of objects in wxDC causes flicker. Below is a tip on how to make a flicker-free app. In order to do this you will need to draw everything using only 3 events:

  • wx.EVT_PAINT
  • wx.EVT_ERASE_BACKGROUND
  • wx.EVT_SIZE

and wx.AutoBufferedPaintDC(). Here is the code that will give you a flicker-free drawing:


class MyPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.NewId())
        self.Bind(wx.EVT_PAINT, self._OnPaint)
        self.Bind(wx.EVT_SIZE, self._OnSize)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self._OnEraseBG)

    def _OnPaint(self, evt):
        dc = wx.BufferedPaintDC(self)
        self.DoDraw(dc)

    def _OnSize(self, evt):
        self.ClientDraw()

    def _OnEraseBG(self, evt):
        # Intentionally empty, as we are using
        # BufferedPaintDC to reduce flicker
        pass

    def ClientDraw(self):
        dc = wx.ClientDC(self)
        dc = wx.BufferedDC(dc)
        self.DoDraw(dc)

    def DoDraw(self, dc):
        dc.Clear()
        #
        # INSERT YOUR DRAWING CODE HERE.
        #

This code redraws all of the context no matter what happens to window: resize, move, init etc… However, if the window can be scrolled it gets a bit more tricky. You will need to override the window’s Scroll function and call self.CientDraw() from within. You may also call self.ClientDraw from within your controls if you need to redraw the window for some reason. Enjoy!

2 Comments

Managed to get TCCB2 working!

Posted on June 3rd, 2008 by Vladiuz, under Web Development.


I have been trying to adapt a few various round corner techniques for my div-layouts project. As you know I have given up on curvyCorners, but TCCB2 (by Roger Johansson) started working with almost 0 tweaking!

I am glad that at least one technique was pretty straight forward.

TCCB2 (Transparent custom corners and borders, version 2), just like curvyCorners is based on JavaScript and CSS styling. Basically it adds new HTML elements to divs, and CSS is defined to style each of the elements.

The main difference however is that TCCB2 uses images to add corners and borders to divs. This has its advantages and disadvantages.

You can see a screenshot of TCCB2 styling (from TCCB2 example) applied to my div-layouts in the screenshot above. I have checked quite a few of my layouts in this styling in opera, safari, ie7, firefox. It seems to work perfectly on all of the browsers.

No Comments

IE Sucks big time!

Posted on May 30th, 2008 by Vladiuz, under Web Development.

I have been trying to make curvyCorners work with my div-layouts all morning. Everything is working in FireFox, Opera, and even my iPhone’s Safari, but the stubborn IE just refuses to layout divs correnctly!

I know there is little news in the fact that IE is a browser written by schoolgirls smoking a good mexican pot, but I had to publish this final burst of frustration before I give up.

No Comments

Walking an HDF tree in Python

Posted on May 29th, 2008 by Vladiuz, under Python, Web Development.

I have just discovered that latest version of ClearSilver’s HDF Python API is not working correctly 100%.

For example getAttrs always returns an empty list. So i had to write my own tree walker method to get all the elements in my HDF dataset. Here is what it looks like:


def hdf_tree_walk(hdf_node, level = 0):
   r = ''
   while hdf_node:
      if hdf_node.child():
         r += "  "*level+"%s = {\n%s\n" % (
         hdf_node.name(),
         hdf_tree_walk(hdf_node.child(),
         level+1))
         r += "  "*level+"}\n"
      else:
         r += "  "*level+"%s = %s\n" % (
            hdf_node.name(),
            hdf_node.value())
      hdf_node = hdf_node.next()
   return r

What a beautiful language! How do you like ” ” * 2? Sorry for offtopic

By the way getObj method is not working either, it always returns a top level dataset.

No Comments

Div Layouts Development Commenced

Posted on May 21st, 2008 by Vladiuz, under Python, Web Development.

I have finally worked out a platform for my div-layouts.vladiuz.com Web interface.

div-layouts.vladiuz.com is a layout gallery for those who are at the start of the stage of html coding. Basically the interface will help you choose a layout for your site. All layouts are done in CSS without modifying any of html code. The interface was inspired by Alessandro Fulciniti’s Layout Gala (which in turn was based on Any Order Columns).

After 3 or 4 weeks of trial and error i figured out that the most flexible platform to develope a layout gallery in would be Python + ClearSilver’s cs templates and hdf data sets. By iterating loading of hdf datasets starting from root directory to end path, I was able to cascade configuration loading, similar to css.

Basically each layout’s settings are located in directory like <root>/layouts/1/2/1/3 and each of the sub directories contain an .hdf file with partial settings. So if layouts 1.2.1.* have common settings, file <root>/layouts/1/2/1/setting.hdf would contain only setting common for all 1.2.1.* layouts, whereas files <root>/layouts/1/2/1/1/setting.hdf, <root>/layouts/1/2/1/2/setting.hdf etc, would contain only end layout-specific settings.

I suspect with this configuration making (and most importantly managing) a couple hundred of planned layouts will be much easier.

By the way this is my first real post. I prefer writing code to writing text, so you will see little news here, but hopefully a lot of results.

No Comments

Test Post.

Posted on May 5th, 2008 by admin, under Uncategorized.

This is a header.

Below is a block of lorem ipsum text:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Now let see an unordered list:

  • Unordered
  • List
  • Item

And an ordered list:

  1. This is
  2. an ordered
  3. list. Works for me.

I am a quote

And I am a code

Here is an example of css code:


div#topmenu .container{
  height: 50px;
  margin-left: 210px;
  margin-right: 190px;
}
div#content.wrapper{
  width: 100%;
  float: left;
}
div#content .container{
  margin-left: 210px;
  margin-right: 190px;
}

6 Comments

 

Search

Links

RSS Feeds