A couple of questions on OGL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wildjack
    New Member
    • Jul 2007
    • 4

    A couple of questions on OGL

    Hi everybody,

    I am developing a little graph editor using python 2.5 and wx 2.8. Whenever I try to add text to a line shape I get a big rectangle on the background which covers the shapes. Is there a way to render the text on a transparent background? I googled and found the same question in several places, but no answers :)

    The second thing is: If I am drawing a lineshape as an spline, control points are fixed. Is there a way to update the position of this control points when I move the shapes which are connected to the line?

    Thanks!
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Sorry, wildjack. I'm not much of a graphics guy.


    I am very interested in feedback on Boa 0.6. I've yet to try switching for 0.5.2 (right in the middle of a big project), but would do it if I heard a few more positive experiences getting the installation to work.

    Keep in touch.

    Comment

    • wildjack
      New Member
      • Jul 2007
      • 4

      #3
      Hi Barton,

      Although I have previous experience with other languages, I'm new to Python (only a few weeks developing things). I began by installing 0.4.4 to give it a try and started developing this graph editor I commented before. I really liked the IDE, so I checked out 0.6.0 from sourceforge CVS and kept on developing with it. The switch was almost seamless. There was some deprecated stuff in the generated code which wouldn't work with the designer, but substituted the code which wasn't working in a few minutes and everything started running again. As for the rest, 0.6.0 runs smoothly. So far, I haven't experienced any problems with it ( Anyway, take into account that I'm working on a small thing, ~3500 lines). If you have further questions, I'll be glad to help :)

      Best regards,
      Wildjack

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by wildjack
        Hi Barton,

        Although I have previous experience with other languages, I'm new to Python (only a few weeks developing things). I began by installing 0.4.4 to give it a try and started developing this graph editor I commented before. I really liked the IDE, so I checked out 0.6.0 from sourceforge CVS and kept on developing with it. The switch was almost seamless. There was some deprecated stuff in the generated code which wouldn't work with the designer, but substituted the code which wasn't working in a few minutes and everything started running again. As for the rest, 0.6.0 runs smoothly. So far, I haven't experienced any problems with it ( Anyway, take into account that I'm working on a small thing, ~3500 lines). If you have further questions, I'll be glad to help :)

        Best regards,
        Wildjack
        Thanks Wildjack. I'd definitely appreciate you hanging around the forum a bit. I've been use Boa 0.5.2 for about 9 months and contribute to its development in some small ways (tiny code updates when I find them) so you are actually running a bit of my work. I just get nervous, changing tools in the middle of a project. It truly is a great piece of software. Saves me hours of layout and I've gotten good at adding to & reusing the generated code without upsetting the designer. Tons o' fun!

        Keep in touch.

        Comment

        • wildjack
          New Member
          • Jul 2007
          • 4

          #5
          Ok, finally I figured out a way to solve the transparent bg problem for text in lineshapes:

          * First we create our own line class inheriting from LineShape.


          * Then we override the DrawRegion method, and we comment out the line marked with *** like this:
          [CODE=python]
          def DrawRegion(self , dc, region, x, y):
          """Format one region at this position."""
          if self.GetDisable Label():
          return

          w, h = region.GetSize( )

          # Get offset from x, y
          xx, yy = region.GetPosit ion()

          xp = xx + x
          yp = yy + y

          # First, clear a rectangle for the text IF there is any
          if len(region.GetF ormattedText()) :
          dc.SetPen(self. GetBackgroundPe n())
          dc.SetBrush(sel f.GetBackground Brush())

          # Now draw the text
          if region.GetFont( ):
          dc.SetFont(regi on.GetFont())
          **** #dc.DrawRectang le(xp - w / 2.0, yp - h / 2.0, w, h)

          if self._pen:
          dc.SetPen(self. _pen)
          dc.SetTextForeg round(region.Ge tActualColourOb ject())

          DrawFormattedTe xt(dc, region.GetForma ttedText(), xp, yp, w, h, region.GetForma tMode())[/CODE]


          This quick fix worked for me. So far everything seems to work fine. As for the line control points problem, I have managed to create control points with handles to move them manually (it's not what I intended to do but it is ok for the moment).
          Last edited by bartonc; Jul 15 '07, 07:18 PM. Reason: Added [CODE=python][/CODE] tags.

          Comment

          • bartonc
            Recognized Expert Expert
            • Sep 2006
            • 6478

            #6
            Thanks for the OGL update, Wildjack.

            Also, I made the upgrade to Boa Constructio 0.6.1. Works great (after I rebooted my machine). Thanks again.

            Comment

            Working...