Esempio n. 1
0
    def __init__ ( self, parent, html, scale_dx, scale_dy ):
        """ Initializes the object.
        """
        wx.Frame.__init__( self, parent, -1, 'Help' )
        self.SetBackgroundColour( WindowColor )
        
        # Wrap the dialog around the image button panel:
        sizer        = wx.BoxSizer( wx.VERTICAL )
        html_control = wh.HtmlWindow( self )
        html_control.SetBorders( 2 )
        html_control.SetPage( html )
        sizer.Add( html_control, 1, wx.EXPAND )
        sizer.Add( wx.StaticLine( self, -1 ), 0, wx.EXPAND )
        b_sizer = wx.BoxSizer( wx.HORIZONTAL )
        button  = wx.Button( self, -1, 'OK' )
        wx.EVT_BUTTON( self, button.GetId(), self._on_ok )
        b_sizer.Add( button, 0 )
        sizer.Add( b_sizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5 )
        self.SetSizer( sizer )
        self.SetAutoLayout( True )
        self.SetSize( wx.Size( int( scale_dx * screen_dx ), 
                               int( scale_dy * screen_dy ) ) )
 
        # Position and show the dialog:
        position_near( parent, self, align_y = -1 )
        self.Show()
Esempio n. 2
0
    def __init__(self, editor):
        """ Initializes the object.
        """
        wx.Frame.__init__(self, editor.control, -1, '', style=wx.SIMPLE_BORDER)
        wx.EVT_ACTIVATE(self, self._on_close_dialog)
        self._closed = False
        self._closeable = True

        panel = color_editor_for(editor, self, self._close_dialog)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel)
        self.SetAutoLayout(True)
        self.SetSizer(sizer)
        sizer.Fit(self)
        position_near(editor.control, self)
        self.Show()
Esempio n. 3
0
 def __init__ ( self, editor ):
     """ Initializes the object.
     """
     wx.Frame.__init__( self, editor.control, -1, '',
                        style = wx.SIMPLE_BORDER )
     wx.EVT_ACTIVATE( self, self._on_close_dialog )
     self._closed    = False
     self._closeable = True
     
     panel = color_editor_for( editor, self, self._close_dialog )
     
     sizer = wx.BoxSizer( wx.VERTICAL )
     sizer.Add( panel )
     self.SetAutoLayout( True )
     self.SetSizer( sizer )
     sizer.Fit( self )
     position_near( editor.control, self )
     self.Show()
Esempio n. 4
0
    def __init__(self, editor):
        """ Initializes the object.
        """
        wx.Frame.__init__(self, editor.control, -1, '', style=wx.SIMPLE_BORDER)
        wx.EVT_ACTIVATE(self, self._on_close_dialog)
        self._closed = False

        dlg_editor = CustomEditor(self,
                                  factory=editor.factory,
                                  ui=editor.ui,
                                  object=editor.object,
                                  name=editor.name,
                                  description=editor.description,
                                  update_handler=self._close_dialog)

        # Wrap the dialog around the image button panel:
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(dlg_editor.control)
        sizer.Fit(self)

        # Position the dialog:
        position_near(editor.control, self)
        self.Show()
Esempio n. 5
0
    def __init__ ( self, editor ):
        """ Initializes the object.
        """
        wx.Frame.__init__( self, editor.control, -1, '',
                           style = wx.SIMPLE_BORDER )
        wx.EVT_ACTIVATE( self, self._on_close_dialog )
        self._closed = False
        
        dlg_editor = CustomEditor( self,
                                   factory        = editor.factory, 
                                   ui             = editor.ui, 
                                   object         = editor.object, 
                                   name           = editor.name, 
                                   description    = editor.description,
                                   update_handler = self._close_dialog )
        
        # Wrap the dialog around the image button panel:
        sizer = wx.BoxSizer( wx.VERTICAL )
        sizer.Add( dlg_editor.control )
        sizer.Fit( self )
 
        # Position the dialog:
        position_near( editor.control, self )
        self.Show()
Esempio n. 6
0
    def position(self, ui):
        """ Positions the associated dialog window on the display.
        """
        view = ui.view
        window = ui.control

        # Set up the default position of the window:
        parent = window.GetParent()
        if parent is None:
            window.Centre(wx.BOTH)
        else:
            position_near(parent, window, offset_y=-30)

        # Calculate the correct width and height for the window:
        cur_width = window.winfo_width()
        cur_height = window.winfo_height()
        width = view.width
        height = view.height

        if width < 0.0:
            width = cur_width
        elif width <= 1.0:
            width = int(width * screen_dx)
        else:
            width = int(width)

        if height < 0.0:
            height = cur_height
        elif height <= 1.0:
            height = int(height * screen_dy)
        else:
            height = int(height)

        # Calculate the correct position for the window:
        x = view.x
        y = view.y

        if x < -99999.0:
            x = (screen_dx - width) / 2
        elif x <= -1.0:
            x = screen_dx - width + int(x) + 1
        elif x < 0.0:
            x = screen_dx - width + int(x * screen_dx)
        elif x <= 1.0:
            x = int(x * screen_dx)
        else:
            x = int(x)

        if y < -99999.0:
            y = (screen_dy - height) / 2
        elif y <= -1.0:
            y = screen_dy - height + int(y) + 1
        elif x < 0.0:
            y = screen_dy - height + int(y * screen_dy)
        elif y <= 1.0:
            y = int(y * screen_dy)
        else:
            y = int(y)

        # Position and size the window as requested:
        window.geometry('%dx%d+%d+%d' % (width, height, x, y))
Esempio n. 7
0
    def position ( self, ui ):
        """ Positions the associated dialog window on the display.
        """
        view   = ui.view
        window = ui.control

        # Set up the default position of the window:
        parent = window.GetParent()
        if parent is None:
           window.Centre( wx.BOTH )
        else:
           position_near( parent, window, offset_y = -30 )
        
        # Calculate the correct width and height for the window:
        cur_width  = window.winfo_width()
        cur_height = window.winfo_height()
        width      = view.width
        height     = view.height
        
        if width < 0.0:
            width = cur_width
        elif width <= 1.0:
            width = int( width * screen_dx )
        else:
            width = int( width )
            
        if height < 0.0:
            height = cur_height
        elif height <= 1.0:
            height = int( height * screen_dy )
        else:
            height = int( height )
            
        # Calculate the correct position for the window:
        x = view.x
        y = view.y
        
        if x < -99999.0:
            x = (screen_dx - width) / 2
        elif x <= -1.0:
            x = screen_dx - width + int( x ) + 1
        elif x < 0.0:
            x = screen_dx - width + int( x * screen_dx )
        elif x <= 1.0:
            x = int( x * screen_dx )
        else:
            x = int( x )
        
        if y < -99999.0:
            y = (screen_dy - height) / 2
        elif y <= -1.0:
            y = screen_dy - height + int( y ) + 1
        elif x < 0.0:
            y = screen_dy - height + int( y * screen_dy )
        elif y <= 1.0:
            y = int( y * screen_dy )
        else:
            y = int( y )
            
        # Position and size the window as requested:
        window.geometry( '%dx%d+%d+%d' % ( width, height, x, y ) )