dialogs/BlockPreviewDialog.py
changeset 1745 f9d32913bad4
parent 1740 b789b695b5c6
child 1764 d5df428640ff
equal deleted inserted replaced
1744:69dfdb26f600 1745:f9d32913bad4
    69 
    69 
    70         # Bind paint event on Preview panel
    70         # Bind paint event on Preview panel
    71         self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
    71         self.Preview.Bind(wx.EVT_PAINT, self.OnPaint)
    72 
    72 
    73         # Add default dialog buttons sizer
    73         # Add default dialog buttons sizer
    74         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
    74         self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
    75         self.Bind(wx.EVT_BUTTON, self.OnOK,
    75         self.Bind(wx.EVT_BUTTON, self.OnOK,
    76                   self.ButtonSizer.GetAffirmativeButton())
    76                   self.ButtonSizer.GetAffirmativeButton())
    77 
    77 
    78         self.Element = None            # Graphic element to display in preview
    78         self.Element = None            # Graphic element to display in preview
    79         self.MinElementSize = None     # Graphic element minimal size
    79         self.MinElementSize = None     # Graphic element minimal size
   115             self.MainSizer.AddGrowableRow(main_growable_row)
   115             self.MainSizer.AddGrowableRow(main_growable_row)
   116 
   116 
   117         # Create a sizer for dividing parameters in two columns
   117         # Create a sizer for dividing parameters in two columns
   118         self.ColumnSizer = wx.BoxSizer(wx.HORIZONTAL)
   118         self.ColumnSizer = wx.BoxSizer(wx.HORIZONTAL)
   119         self.MainSizer.AddSizer(self.ColumnSizer, border=20,
   119         self.MainSizer.AddSizer(self.ColumnSizer, border=20,
   120               flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   120               flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
   121 
   121 
   122         # Create a sizer for left column
   122         # Create a sizer for left column
   123         self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
   123         self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
   124                                               rows=left_rows, vgap=5)
   124                                               rows=left_rows, vgap=5)
   125         self.LeftGridSizer.AddGrowableCol(0)
   125         self.LeftGridSizer.AddGrowableCol(0)
   126         if left_growable_row is not None:
   126         if left_growable_row is not None:
   127             self.LeftGridSizer.AddGrowableRow(left_growable_row)
   127             self.LeftGridSizer.AddGrowableRow(left_growable_row)
   128         self.ColumnSizer.AddSizer(self.LeftGridSizer, 1, border=5,
   128         self.ColumnSizer.AddSizer(self.LeftGridSizer, 1, border=5,
   129               flag=wx.GROW|wx.RIGHT|wx.EXPAND)
   129               flag=wx.GROW | wx.RIGHT | wx.EXPAND)
   130 
   130 
   131         # Create a sizer for right column
   131         # Create a sizer for right column
   132         self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
   132         self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
   133                                                rows=right_rows, vgap=0)
   133                                                rows=right_rows, vgap=0)
   134         self.RightGridSizer.AddGrowableCol(0)
   134         self.RightGridSizer.AddGrowableCol(0)
   135         if right_growable_row is not None:
   135         if right_growable_row is not None:
   136             self.RightGridSizer.AddGrowableRow(right_growable_row)
   136             self.RightGridSizer.AddGrowableRow(right_growable_row)
   137         self.ColumnSizer.AddSizer(self.RightGridSizer, 1, border=5,
   137         self.ColumnSizer.AddSizer(self.RightGridSizer, 1, border=5,
   138               flag=wx.GROW|wx.LEFT)
   138               flag=wx.GROW | wx.LEFT)
   139 
   139 
   140         self.SetSizer(self.MainSizer)
   140         self.SetSizer(self.MainSizer)
   141 
   141 
   142     def SetMinElementSize(self, size):
   142     def SetMinElementSize(self, size):
   143         """
   143         """
   233         Show an error message dialog over this dialog
   233         Show an error message dialog over this dialog
   234         @param message: Error message to display
   234         @param message: Error message to display
   235         """
   235         """
   236         dialog = wx.MessageDialog(self, message,
   236         dialog = wx.MessageDialog(self, message,
   237                                   _("Error"),
   237                                   _("Error"),
   238                                   wx.OK|wx.ICON_ERROR)
   238                                   wx.OK | wx.ICON_ERROR)
   239         dialog.ShowModal()
   239         dialog.ShowModal()
   240         dialog.Destroy()
   240         dialog.Destroy()
   241 
   241 
   242     def OnOK(self, event):
   242     def OnOK(self, event):
   243         """
   243         """