commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8363 - in trunk/gnue-designer/src: forms/PagePainter ui/wx/uihel


From: jcater
Subject: [gnue] r8363 - in trunk/gnue-designer/src: forms/PagePainter ui/wx/uihelpers/doccanvas
Date: Tue, 4 Apr 2006 21:35:12 -0500 (CDT)

Author: jcater
Date: 2006-04-04 21:35:12 -0500 (Tue, 04 Apr 2006)
New Revision: 8363

Modified:
   trunk/gnue-designer/src/forms/PagePainter/PagePainter.py
   trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py
   trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py
Log:
style cleanup

Modified: trunk/gnue-designer/src/forms/PagePainter/PagePainter.py
===================================================================
--- trunk/gnue-designer/src/forms/PagePainter/PagePainter.py    2006-04-05 
02:23:02 UTC (rev 8362)
+++ trunk/gnue-designer/src/forms/PagePainter/PagePainter.py    2006-04-05 
02:35:12 UTC (rev 8363)
@@ -69,18 +69,14 @@
         self.SetFont(fixed_font)
 
         if not common.char_x_scale:
-            avg_w = 0
-            avg_h = 0
-            for char in string.digits + string.letters:
-                w, h = dc.GetTextExtent(char)
-                avg_w += w
-                avg_h += h
-            common.char_x_scale = avg_w // len(string.digits + string.letters)
-            common.char_y_scale = avg_h // len(string.digits + string.letters)
 
+            ttl_w, h = dc.GetTextExtent(string.digits + string.letters)
+            common.char_x_scale = ttl_w // (
+                    len(string.digits + string.letters)) + 1
+
             # Make the scale slightly larger, so that input widgets
             # are bigger than text labels.
-            common.char_y_scale += 4
+            common.char_y_scale = h + 4
 
         canvas = self.canvas = PagePainterCanvas(self)
 

Modified: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py 2006-04-05 
02:23:02 UTC (rev 8362)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/canvas.py 2006-04-05 
02:35:12 UTC (rev 8363)
@@ -22,7 +22,7 @@
 # $Id$
 
 """
-The main DocumentCanvas class that implements a scrollable 
+The main DocumentCanvas class that implements a scrollable
 wysiwyg editor.
 """
 
@@ -66,7 +66,7 @@
         super(DocumentCanvas, self).__init__(*arguments, **keywords)
 
         # Set up the color space
-        initialize()
+        initialize(panel_color = self.GetBackgroundColour())
 
         self.ordered_widget_list = []
 
@@ -201,7 +201,7 @@
         self.__mouse_hot_spots = []
 
         # The updateRegion is not in scrolled coordinates.
-        scrollWindowOriginX, scrollWindowOriginY = 
self.CalcUnscrolledPosition(0, 0)
+        scroll_x, scroll_y = self.CalcUnscrolledPosition(0, 0)
 
         selection_area = None
 
@@ -211,13 +211,13 @@
 
             refresh_area = widget.refresh_area
 
-            (objectX, objectY,
-            objectWidth, objectHeight) = refresh_area.Get()
+            (obj_x, obj_y,
+            obj_width, obj_height) = refresh_area.Get()
 
             # Calculate the area, offset by the scrollwindow's origin
-            area = wx.Rect(objectX - scrollWindowOriginX,
-                            objectY - scrollWindowOriginY,
-                            objectWidth, objectHeight)
+            area = wx.Rect(obj_x - scroll_x,
+                           obj_y - scroll_y,
+                           obj_width, obj_height)
 
 
             # Keep track of the overall area of all the selected
@@ -231,16 +231,16 @@
         # Draw a box around all the selected widgets
         if selection_area:
 
-            x, y, w, h = selection_area.Get()
+            sel_x, sel_y, sel_w, sel_h = selection_area.Get()
 
             # Not sure why we have to do this, but it makes the
             # box draw correctly.
-            x += 2
-            y += 2
-            w -= 4
-            h -= 4
+            sel_x += 2
+            sel_y += 2
+            sel_w -= 4
+            sel_h -= 4
 
-            selection_area = wx.Rect(x,y,w,h)
+            selection_area = wx.Rect(sel_x,sel_y,sel_w,sel_h)
             self.refresh_scrolled_area(selection_area)
 
         self.__selection_area = selection_area
@@ -255,210 +255,208 @@
         """
 
         # The updateRegion is not in scrolled coordinates.
-        (scrollWindowOriginX,
-         scrollWindowOriginY) = self.CalcUnscrolledPosition(0, 0)
+        (scroll_x,
+         scroll_y) = self.CalcUnscrolledPosition(0, 0)
 
         # wx.BufferedDC doesn't work here since it doesn't handle
         # scrolled windows  and always allocates a buffer the size of
         # the client area. So instead we'll  allocate a wx.MemoryDC,
-        # draw into it then blit it to our paintDC.
-        paintDC = wx.PaintDC(self)
-        self.PrepareDC(paintDC)
+        # draw into it then blit it to our paint_dc.
+        paint_dc = wx.PaintDC(self)
+        self.PrepareDC(paint_dc)
 
         # Calculate the rectangle that needs updating in scrolled coordinates
-        updateRect = self.GetUpdateRegion().GetBox()
-        bufferX = updateRect.GetLeft() + scrollWindowOriginX
-        bufferY = updateRect.GetTop() + scrollWindowOriginY
-        bufferWidth = updateRect.GetWidth()
-        bufferHeight = updateRect.GetHeight()
+        update_area = self.GetUpdateRegion().GetBox()
+        buff_x = update_area.GetLeft() + scroll_x
+        buff_y = update_area.GetTop() + scroll_y
+        buff_width = update_area.GetWidth()
+        buff_height = update_area.GetHeight()
 
-        memoryDC = wx.MemoryDC()
-        offscreenBuffer = wx.EmptyBitmap(bufferWidth, bufferHeight)
-        memoryDC.SelectObject(offscreenBuffer)
-        memoryDC.SetDeviceOrigin(-bufferX, -bufferY)
+        memory_dc = wx.MemoryDC()
+        offscreen_buffer = wx.EmptyBitmap(buff_width, buff_height)
+        memory_dc.SelectObject(offscreen_buffer)
+        memory_dc.SetDeviceOrigin(-buff_x, -buff_y)
 
         ## Debugging code that makes it easy to see which areas are updating.
         if 0:
-            success = paintDC.Blit(bufferX, bufferY,
-                                    bufferWidth, bufferHeight,
-                                    paintDC,
-                                    bufferX, bufferY,
+            success = paint_dc.Blit(buff_x, buff_y,
+                                    buff_width, buff_height,
+                                    paint_dc,
+                                    buff_x, buff_y,
                                     wx.SRC_INVERT)
             time.sleep(1)
-            success = paintDC.Blit(bufferX, bufferY,
-                                    bufferWidth, bufferHeight,
-                                    paintDC,
-                                    bufferX, bufferY,
+            success = paint_dc.Blit(buff_x, buff_y,
+                                    buff_width, buff_height,
+                                    paint_dc,
+                                    buff_x, buff_y,
                                     wx.SRC_INVERT)
 
 
-        memoryDC.BeginDrawing()
+        memory_dc.BeginDrawing()
 
-        self.draw_background(memoryDC)
-        self.draw_widgets(memoryDC)
+        self.draw_background(memory_dc)
+        self.draw_widgets(memory_dc)
 
         # Move the offscreen bitmap onto the scrolled window
-        paintDC.Blit(bufferX, bufferY, bufferWidth, bufferHeight,
-                      memoryDC, bufferX, bufferY)
+        paint_dc.Blit(buff_x, buff_y, buff_width, buff_height,
+                      memory_dc, buff_x, buff_y)
 
         # Draw the mouse move buffer, if applicable
         if self.__mouse_move_area:
-            x,y,w,h = self.__mouse_move_area.Get()
-            paintDC.Blit(x, y, w, h, self.__mouse_move_buffer, 0, 0,
+            x, y, width, height = self.__mouse_move_area.Get()
+            paint_dc.Blit(x, y, width, height, self.__mouse_move_buffer, 0, 0,
                          wx.AND, True, 0, 0)
 
-        memoryDC.EndDrawing()
+        memory_dc.EndDrawing()
 
 
-    def draw_widgets(self, dc):
+    def draw_widgets(self, target_dc):
         """
         Draw the individual widgets
         """
 
         updateRegion = self.GetUpdateRegion()
 
-        (scrollWindowOriginX,
-         scrollWindowOriginY) = self.CalcUnscrolledPosition(0, 0)
+        (scroll_x,
+         scroll_y) = self.CalcUnscrolledPosition(0, 0)
 
-        dcOriginX, dcOriginY = dc.GetDeviceOrigin()
+        dc_x, dc_y = target_dc.GetDeviceOrigin()
 
         # Draw widgets (in the reverse order they are stored in our list)
         for widget in self.ordered_widget_list[::-1]:
             refresh_area = widget.refresh_area
 
-            (objectX, objectY,
-             objectWidth, objectHeight) = refresh_area.Get()
+            (obj_x, obj_y,
+             obj_width, obj_height) = refresh_area.Get()
 
             # Calculate the area, offset by the scrollwindow's origin
-            area = wx.Rect(objectX - scrollWindowOriginX,
-                           objectY - scrollWindowOriginY,
-                           objectWidth, objectHeight)
+            area = wx.Rect(obj_x - scroll_x,
+                           obj_y - scroll_y,
+                           obj_width, obj_height)
 
 
             if (updateRegion.ContainsRect(area) != wx.OutRegion and
                 widget.visible):
 
-                dc.SetDeviceOrigin(objectX + dcOriginX, objectY + dcOriginY)
-                widget.draw(dc)
-                dc.SetDeviceOrigin(dcOriginX, dcOriginY)
+                target_dc.SetDeviceOrigin(obj_x + dc_x, obj_y + dc_y)
+                widget.draw(target_dc)
+                target_dc.SetDeviceOrigin(dc_x, dc_y)
 
 
         # Draw a box around all the selected widgets
-        if self.__selection_area is not None and not 
self.__hide_selection_frame:
-            x, y, w, h = self.__selection_area.Get()
-            self.__draw_selection_box(dc, x, y, w, h)
+        if self.__selection_area is not None and \
+           not self.__hide_selection_frame:
+            x, y, width, height = self.__selection_area.Get()
+            self.__draw_selection_box(target_dc, x, y, width, height)
 
 
-    def __draw_selection_box(self, dc, x, y, w, h, xor=False):
+    def __draw_selection_box(self, target_dc, x, y, width, height, xor=False):
 
         self.__mouse_hot_spots = []
         add_hotspot = self.__mouse_hot_spots.append
 
         # TODO: quick fix for enforcing a min size (fix!)
-        w = max(w, 17)
-        h = max(h, 17)
+        width = max(width, 17)
+        height = max(height, 17)
 
         # Draw the main border
-        dc.SetBrush(wx.TRANSPARENT_BRUSH)
+        target_dc.SetBrush(wx.TRANSPARENT_BRUSH)
         if xor:
-            dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
-            dc.SetLogicalFunction(wx.XOR)
+            target_dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
+            target_dc.SetLogicalFunction(wx.XOR)
         else:
-            dc.SetPen(wx.Pen(color_map['selectionframe']))
+            target_dc.SetPen(wx.Pen(color_map['selectionframe']))
 
-        dc.DrawRectangle(x, y, w, h)
+        target_dc.DrawRectangle(x, y, width, height)
 
         # Draw the sizer grippers
         if not xor:
-            dc.SetBrush(wx.Brush(wx.WHITE))
+            target_dc.SetBrush(wx.Brush(wx.WHITE))
 
         for bx, by, position in (
             (x - 2, y - 2, 'resize-ul'),                  # upper left
-            (x + w - 3, y - 2, 'resize-ur'),              # upper right
-            (x - 2, y + h - 3, 'resize-ll'),              # lower left
-            (x + w - 3, y + h - 3, 'resize-lr'),          # lower right
-            (x - 2 + w / 2, y - 2, 'resize-top'),         # top middle
-            (x - 2, y - 2 + h / 2,'resize-left'),         # left middle
-            (x + w - 3, y - 2 + h / 2, 'resize-right'),   # right middle
-            (x - 2 + w / 2 , y + h - 3, 'resize-bottom'), # bottom middle
+            (x + width - 3, y - 2, 'resize-ur'),              # upper right
+            (x - 2, y + height - 3, 'resize-ll'),              # lower left
+            (x + width - 3, y + height - 3, 'resize-lr'),          # lower 
right
+            (x - 2 + width / 2, y - 2, 'resize-top'),         # top middle
+            (x - 2, y - 2 + height / 2,'resize-left'),         # left middle
+            (x + width - 3, y - 2 + height / 2, 'resize-right'),   # right 
middle
+            (x - 2 + width / 2 , y + height - 3, 'resize-bottom'), # bottom 
middle
             ):
 
             rect = wx.Rect(bx,by,5,5)
-            dc.DrawRectangleRect(rect)
+            target_dc.DrawRectangleRect(rect)
             if not xor:
                 add_hotspot((rect,position))
 
         # Add hotspot markers for the selection box
         if not xor:
-            add_hotspot((wx.Rect(x, y, 1, h), 'resize-left'))
-            add_hotspot((wx.Rect(x, y, w, 1), 'resize-top'))
-            add_hotspot((wx.Rect(x + w - 1, y, 1, h), 'resize-right'))
-            add_hotspot((wx.Rect(x, y + h - 1, w, 1), 'resize-bottom'))
-            add_hotspot((wx.Rect(x + 1, y + 1, w - 1, h - 1), 'move'))
+            add_hotspot((wx.Rect(x, y, 1, height), 'resize-left'))
+            add_hotspot((wx.Rect(x, y, width, 1), 'resize-top'))
+            add_hotspot((wx.Rect(x + width - 1, y, 1, height), 'resize-right'))
+            add_hotspot((wx.Rect(x, y + height - 1, width, 1), 
'resize-bottom'))
+            add_hotspot((wx.Rect(x + 1, y + 1, width - 1, height - 1), 'move'))
 
 
-    def draw_background(self, dc):
+    def draw_background(self, target_dc):
         """
         Draw a background (with grid if appropriate)
         """
-        dc.SetBackgroundMode(wx.TRANSPARENT)
-        dc.Clear()
+        target_dc.SetBackgroundMode(wx.TRANSPARENT)
+        target_dc.Clear()
         #
         # Draw the grid
         #
-        if self.grid_style == 1:
+        if self.grid_style == GRID_LINES:
             SOLIDSPACING = 4
-            w, h = self.GetClientSizeTuple()
+            width, height = self.GetClientSizeTuple()
             pen1 = wx.Pen(color_map['workspaceGrid'], 1, wx.SHORT_DASH)
             pen2 = wx.Pen(color_map['workspaceGrid'], 1, wx.SOLID)
-            dc.SetPen(pen1)
+            target_dc.SetPen(pen1)
 
             # Draw vertical grid lines
-            switchToMainPen = False
-            for x in xrange(self.grid_x_spacing,w,self.grid_x_spacing):
+            switch_pens = False
+            for x in xrange(self.grid_x_spacing, width, self.grid_x_spacing):
                 if not x % SOLIDSPACING:
-                    switchToMainPen = True
-                    dc.SetPen(pen2)
-                dc.DrawLine(x,0,x,h-1)
-                if switchToMainPen:
-                    dc.SetPen(pen1)
-                    switchToMainPen = False
+                    switch_pens = True
+                    target_dc.SetPen(pen2)
+                target_dc.DrawLine(x,0,x,height-1)
+                if switch_pens:
+                    target_dc.SetPen(pen1)
+                    switch_pens = False
 
 
             # Draw horizontal grid lines
-            switchToMainPen = False
-            for y in xrange(self.grid_y_spacing, h, self.grid_y_spacing):
+            switch_pens = False
+            for y in xrange(self.grid_y_spacing, height, self.grid_y_spacing):
                 if not y % SOLIDSPACING:
-                    switchToMainPen = True
-                    dc.SetPen(pen2)
-                dc.DrawLine(0, y, w, y)
-                if switchToMainPen:
-                    dc.SetPen(pen1)
-                    switchToMainPen = False
+                    switch_pens = True
+                    target_dc.SetPen(pen2)
+                target_dc.DrawLine(0, y, width, y)
+                if switch_pens:
+                    target_dc.SetPen(pen1)
+                    switch_pens = False
 
-        elif self.grid_style == 2:
+        elif self.grid_style == GRID_DOTS:
             SOLIDSPACING = 4
-            w, h = self.GetClientSizeTuple()
-            pen1 = wx.Pen(color_map['workspaceGrid'], 1, wx.SOLID)
-            pen2 = wx.Pen(color_map['workspaceGrid'], 1, wx.SOLID)
-            dc.SetPen(pen1)
+            width, height = self.GetClientSizeTuple()
+            pen = wx.Pen(color_map['workspaceGrid'], 1, wx.SOLID)
+            target_dc.SetPen(pen)
 
+            for x in xrange(self.grid_x_spacing,width,self.grid_x_spacing):
+                for y in xrange(self.grid_y_spacing, height, 
self.grid_y_spacing):
+                    target_dc.DrawPoint(x,y)
 
-            dc.SetPen(pen2)
-            for x in xrange(self.grid_x_spacing,w,self.grid_x_spacing):
-                for y in xrange(self.grid_y_spacing, h, self.grid_y_spacing):
-                    dc.DrawPoint(x,y)
-
             # Draw vertical grid lines
-            for x in xrange(self.grid_x_spacing*SOLIDSPACING, w,
+            for x in xrange(self.grid_x_spacing*SOLIDSPACING, width,
                             self.grid_x_spacing*SOLIDSPACING):
-                dc.DrawLine(x,0,x,h-1)
+                target_dc.DrawLine(x,0,x,height-1)
 
 
             # Draw horizontal grid lines
-            for y in xrange(self.grid_y_spacing*SOLIDSPACING, h,
+            for y in xrange(self.grid_y_spacing*SOLIDSPACING, height,
                             self.grid_y_spacing*SOLIDSPACING):
-                dc.DrawLine(0, y, w, y)
+                target_dc.DrawLine(0, y, width, y)
 
 
 
@@ -727,38 +725,38 @@
         # Create a bitmap of our widgets in an offscreen buffer
         # so we can redraw them as the mouse moves
 
-        bufferX = area.GetLeft()
-        bufferY = area.GetTop()
-        bufferWidth = area.GetWidth()
-        bufferHeight = area.GetHeight()
+        buff_x = area.GetLeft()
+        buff_y = area.GetTop()
+        buff_width = area.GetWidth()
+        buff_height = area.GetHeight()
 
-        memoryDC = wx.MemoryDC()
-        offscreenBuffer = wx.EmptyBitmap(bufferWidth, bufferHeight)
+        memory_dc = wx.MemoryDC()
+        offscreen_buffer = wx.EmptyBitmap(buff_width, buff_height)
         maskColor = wx.WHITE
 
-        memoryDC.SelectObject(offscreenBuffer)
-        memoryDC.SetDeviceOrigin(-bufferX, -bufferY)
+        memory_dc.SelectObject(offscreen_buffer)
+        memory_dc.SetDeviceOrigin(-buff_x, -buff_y)
 
-        memoryDC.SetBackground(wx.Brush(maskColor))
-        memoryDC.Clear()
+        memory_dc.SetBackground(wx.Brush(maskColor))
+        memory_dc.Clear()
 
         for widget in widgets:
-            (objectX, objectY,
-             objectWidth, objectHeight) = widget.refresh_area.Get()
+            (obj_x, obj_y,
+             obj_width, obj_height) = widget.refresh_area.Get()
 
-            memoryDC.SetDeviceOrigin(objectX - bufferX, objectY - bufferY)
-            widget.draw_widget(memoryDC)
-            memoryDC.SetDeviceOrigin(0,0)
+            memory_dc.SetDeviceOrigin(obj_x - buff_x, obj_y - buff_y)
+            widget.draw_widget(memory_dc)
+            memory_dc.SetDeviceOrigin(0,0)
 
         # Draw a selection box
         sx, sy, sw, sh = self.__selection_area.Get()
-        self.__draw_selection_box(memoryDC, 2, 2, sw, sh)
+        self.__draw_selection_box(memory_dc, 2, 2, sw, sh)
 
-        memoryDC.EndDrawing()
+        memory_dc.EndDrawing()
 
-        self.__mouse_move_dx = x - bufferX
-        self.__mouse_move_dy = y - bufferY
-        self.__mouse_move_buffer = memoryDC
+        self.__mouse_move_dx = x - buff_x
+        self.__mouse_move_dy = y - buff_y
+        self.__mouse_move_buffer = memory_dc
         self.__mouse_move_area = area
 
         # Hide the real widgets
@@ -834,55 +832,56 @@
         and drawing the new one.
         """
         orientation = self.__mouse_resize_orientation
-        dc = wx.ClientDC(self)
-        dc.BeginDrawing()
+        target_dc = wx.ClientDC(self)
+        target_dc.BeginDrawing()
 
         # If there's an existing frame, remove it first.
         if self.__mouse_resize_last_area:
-            self.__draw_selection_box(dc,
+            self.__draw_selection_box(target_dc,
                        *self.__mouse_resize_last_area + [True])
 
         # If x is None, then we're only erasing the old,
         # not drawing a new frame.
         if x is not None:
-            dx = x - self.__mouse_resize_start_x
-            dy = y - self.__mouse_resize_start_y
+            delta_x = x - self.__mouse_resize_start_x
+            delta_y = y - self.__mouse_resize_start_y
 
-            ox, oy, ow, oh = self.__mouse_resize_orig_area.Get()
+            start_x, start_y, start_width, start_height = 
self.__mouse_resize_orig_area.Get()
 
-            ox2 = ox + ow - 1
-            oy2 = oy + oh - 1
+            start_x2 = start_x + start_width - 1
+            start_y2 = start_y + start_height - 1
 
             # The anchor point and changable points
             # varie based on the resize orientation.
             if orientation == 'left':
-                ox += dx
+                start_x += delta_x
             elif orientation == 'right':
-                ox2 += dx
+                start_x2 += delta_x
             elif orientation == 'top':
-                oy += dy
+                start_y += delta_y
             elif orientation == 'bottom':
-                oy2 += dy
+                start_y2 += delta_y
             elif orientation == 'ul':
-                ox += dx
-                oy += dy
+                start_x += delta_x
+                start_y += delta_y
             elif orientation == 'ur':
-                ox2 += dx
-                oy += dy
+                start_x2 += delta_x
+                start_y += delta_y
             elif orientation == 'll':
-                ox += dx
-                oy2 += dy
+                start_x += delta_x
+                start_y2 += delta_y
             elif orientation == 'lr':
-                ox2 += dx
-                oy2 += dy
+                start_x2 += delta_x
+                start_y2 += delta_y
 
-            ow = ox2 - ox
-            oh = oy2 - oy
+            start_width = start_x2 - start_x
+            start_height = start_y2 - start_y
 
-            self.__mouse_resize_last_area = last = [ox, oy, ow, oh]
-            self.__draw_selection_box(dc, *last + [True])
+            self.__mouse_resize_last_area = last = [
+                  start_x, start_y, start_width, start_height]
+            self.__draw_selection_box(target_dc, *last + [True])
 
-        dc.EndDrawing()
+        target_dc.EndDrawing()
 
 
     def __stop_resizing(self):
@@ -912,11 +911,11 @@
         """
         Draw one box shape and possibly erase another.
         """
-        dc = wx.ClientDC(self)
-        dc.BeginDrawing()
-        dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
-        dc.SetBrush(wx.TRANSPARENT_BRUSH)
-        dc.SetLogicalFunction(wx.XOR)
+        target_dc = wx.ClientDC(self)
+        target_dc.BeginDrawing()
+        target_dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
+        target_dc.SetBrush(wx.TRANSPARENT_BRUSH)
+        target_dc.SetLogicalFunction(wx.XOR)
 
         start = self.__mouse_rubberband_start
         last = self.__mouse_rubberband_last
@@ -924,15 +923,15 @@
         # Erase the old box
         if last:
             r = wx.RectPP(start, last)
-            dc.DrawRectangleRect(r)
+            target_dc.DrawRectangleRect(r)
 
         # Draw the new box
         if x is not None:
             r = wx.RectPP(start, (x,y))
-            dc.DrawRectangleRect(r)
+            target_dc.DrawRectangleRect(r)
             self.__mouse_rubberband_last = (x,y)
 
-        dc.EndDrawing()
+        target_dc.EndDrawing()
 
     def __stop_rubberband(self, x, y):
         """
@@ -945,42 +944,38 @@
         return wx.RectPP(self.__mouse_rubberband_start, (x, y))
 
 
-    # ---------------------------------------------------------------
-    # Drag and Drop support
-    # ---------------------------------------------------------------
-    def OnData(self, dataObject, x, y, result):
-        """
-          Handle default behavior of copy and move
-        """
-        # TODO: this is left over from SimpleCanvas.py... not used yet.
-        if result == wx.DragMove or result == wx.DragCopy:
-            if(self.internalDnDItem != None) and(result == wx.DragMove):
-                assert(self.ordered_widget_list.count(self.internalDnDItem) == 
1)
+    ## ---------------------------------------------------------------
+    ## Drag and Drop support
+    ## ---------------------------------------------------------------
+    #def OnData(self, dataObject, x, y, result):
+        #"""
+          #Handle default behavior of copy and move
+        #"""
+        ## TODO: this is left over from SimpleCanvas.py... not used yet.
+        #if result == wx.DragMove or result == wx.DragCopy:
+            #if(self.internalDnDItem != None) and(result == wx.DragMove):
+                #assert(self.ordered_widget_list.count(self.internalDnDItem) 
== 1)
 
-                widget = self.ConvertDataObjectToDrawableObject(dataObject, x, 
y, True)
-                x = widget.refresh_area.GetLeft()
-                y = widget.refresh_area.GetTop()
+                #widget = self.ConvertDataObjectToDrawableObject(dataObject, 
x, y, True)
+                #x = widget.refresh_area.GetLeft()
+                #y = widget.refresh_area.GetTop()
 
-                self.ordered_widget_list.remove(self.internalDnDItem)
-                self.ordered_widget_list.insert(0, self.internalDnDItem)
-                self.internalDnDItem.MoveTo(x, y)
-                self.internalDnDItem.Show(True)
-            else:
+                #self.ordered_widget_list.remove(self.internalDnDItem)
+                #self.ordered_widget_list.insert(0, self.internalDnDItem)
+                #self.internalDnDItem.MoveTo(x, y)
+                #self.internalDnDItem.Show(True)
+            #else:
 
-                widget = self.ConvertDataObjectToDrawableObject(dataObject, x, 
y, False)
-                x = widget.refresh_area.GetLeft()
-                y = widget.refresh_area.GetTop()
+                #widget = self.ConvertDataObjectToDrawableObject(dataObject, 
x, y, False)
+                #x = widget.refresh_area.GetLeft()
+                #y = widget.refresh_area.GetTop()
 
-                self.ordered_widget_list.insert(0, widget)
-                widget.force_canvas_refresh()
-        return result
+                #self.ordered_widget_list.insert(0, widget)
+                #widget.force_canvas_refresh()
+        #return result
 
 
     # ---------------------------------------------------------------
-    # Misc management stuff
-    # ---------------------------------------------------------------
-
-    # ---------------------------------------------------------------
     # Hit Tests
     # ---------------------------------------------------------------
     def select_hit_test(self, x, y):

Modified: trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py
===================================================================
--- trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py       
2006-04-05 02:23:02 UTC (rev 8362)
+++ trunk/gnue-designer/src/ui/wx/uihelpers/doccanvas/settings.py       
2006-04-05 02:35:12 UTC (rev 8363)
@@ -30,7 +30,7 @@
 color_map = {}
 font_map = {}
 
-def build_color_map():
+def build_color_map(panel_color):
 
     global color_map
     if color_map:
@@ -40,11 +40,12 @@
     color_map['selectedframe'] = wx.BLUE # 
wx.SystemSettings_GetColour(wx.SYS_COLOUR_HOTLIGHT)
     color_map['workspace'] = 
wx.SystemSettings_GetColour(wx.SYS_COLOUR_APPWORKSPACE)
     color_map['workspaceGrid'] = wx.Colour(240,240,240) # TODO: ???
-    color_map['panel'] = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
+    color_map['panel'] = panel_color 
#wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
     color_map['text'] = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
     color_map['widget'] = wx.BLACK # 
wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWFRAME)
     color_map['widgetdark'] = 
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW)
-    color_map['widgetlight'] = 
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DLIGHT)
+    color_map['widgetlight'] = 
wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW)
+       #wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DLIGHT)
     color_map['widgetback'] = wx.WHITE
 
 
@@ -66,9 +67,9 @@
 
 
 
-def initialize():
+def initialize(panel_color):
     if color_map:
         return
 
     build_font_map()
-    build_color_map()
\ No newline at end of file
+    build_color_map(panel_color)
\ No newline at end of file





reply via email to

[Prev in Thread] Current Thread [Next in Thread]