1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
# -*- coding: iso-8859-1 -*-
import wx
import buttons
#-------------------------------------------------------------------
#===================================================================
#== Panneau contenant les boutons de selection (arête,sommet,face)==
#===================================================================
class PanneauSelect(wx.Panel):
def __init__(self,parent):
wx.Panel.__init__(self,parent,-1,style = wx.DOUBLE_BORDER)
boxSelec = wx.StaticBox(self, -1, "Types de sélection")
bsizerS = wx.StaticBoxSizer(boxSelec, wx.HORIZONTAL)
som = wx.Bitmap("../images/selecSom.gif", wx.BITMAP_TYPE_GIF)
arete = wx.Bitmap("../images/selecArete.gif", wx.BITMAP_TYPE_GIF)
face = wx.Bitmap("../images/selecFace.gif", wx.BITMAP_TYPE_GIF)
#Toggles Boutons : sélections de sommets, d'arêtes et de faces
selecSom = buttons.GenBitmapToggleButton(self, 1, None)
selecSom.SetBitmapLabel(som)
selecArete = buttons.GenBitmapToggleButton(self, 2, None)
selecArete.SetBitmapLabel(arete)
selecFace = buttons.GenBitmapToggleButton(self, 3, None)
selecFace.SetBitmapLabel(face)
selecSom.SetToolTipString("sélection de sommets")
selecArete.SetToolTipString("sélection d'arêtes")
selecFace.SetToolTipString("sélection de faces")
bsizerS.Add(selecSom, 1, wx.ALL|wx.LEFT, 2)
bsizerS.Add(selecArete, 1, wx.ALL|wx.LEFT, 2)
bsizerS.Add(selecFace, 1,wx.ALL|wx.LEFT, 2)
sampleList = ['Fil de fer', 'Texture', 'Texture + Eclairage']
rb = wx.RadioBox(self, -1, "Visualisation",wx.DefaultPosition, wx.DefaultSize,sampleList, 1, wx.RA_SPECIFY_COLS)
border = wx.BoxSizer()
border.Add(bsizerS, 1, wx.SHAPED|wx.ALL, 10)
border.Add(rb, 1, wx.SHAPED|wx.ALL, 11)
self.SetSizer(border)
#-----------------------------
#wx.EVT_TOGGLEBUTTON(self, selecSom.GetId(), self.OnToggleButton)
#wx.EVT_TOGGLEBUTTON(self, selecFace.GetId(), self.OnToggleButton)
#wx.EVT_TOGGLEBUTTON(self, selecArete.GetId(), self.OnToggleButton)
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton, selecSom)
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton, selecArete)
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton, selecFace)
#-----------------------------
#===================
#== Fonctions ==
#===================
def OnToggleButton(self, event):
if event.GetEventObject().GetValue() == True:
if event.GetEventObject().GetId() == 1: #bouton de sélection des sommets
selecArete.SetValue(False)
selecFace.SetValue(False)
#appliquer la fonction de sélection des sommets
elif event.GetEventObject().GetId() == 2: #bouton de sélection des arètes
selecFace.SetValue(False)
selecSom.SetValue(False)
#appliquer la fonction de sélection des arètes
else:
selecArete.SetValue(False)
selecSom.SetValue(False)
#appliquer la fonction de sélection des faces |