Ejemplo n.º 1
0
 def SetValue(self, value):
     minValue, maxValue = self.numCtrl.GetBounds()
     if maxValue is not None and value > maxValue:
         value = maxValue
     if minValue is not None and value < minValue:
         value = minValue
     res = self.numCtrl.SetValue(value)
     wx.PostEvent(self, eg.ValueChangedEvent(self.GetId(), value=value))
     return res
Ejemplo n.º 2
0
 def SetValue(self, value):
     if isinstance(self.ctrl, eg.Classes.SpinNumCtrl.SpinNumCtrl):
         if isinstance(value, (str, unicode)):
             value = float(value)
         minValue, maxValue = self.ctrl.numCtrl.GetBounds()
         if maxValue is not None and value > maxValue:
             value = maxValue
         if minValue is not None and value < minValue:
             value = minValue
     elif isinstance(value, (int, float)):
         value = str(value)
     res = self.ctrl.SetValue(value)
     wx.PostEvent(self, eg.ValueChangedEvent(self.GetId(), value = value))
     return res
Ejemplo n.º 3
0
 def OnButton(self, event):
     colourData = wx.ColourData()
     colourData.SetChooseFull(True)
     colourData.SetColour(self.value)
     for i, colour in enumerate(eg.config.colourPickerCustomColours):
         colourData.SetCustomColour(i, colour)
     dialog = wx.ColourDialog(self.GetParent(), colourData)
     dialog.SetTitle(self.title)
     if dialog.ShowModal() == wx.ID_OK:
         colourData = dialog.GetColourData()
         self.SetValue(colourData.GetColour().Get())
         event.Skip()
     eg.config.colourPickerCustomColours = [
         colourData.GetCustomColour(i).Get() for i in range(16)
     ]
     dialog.Destroy()
     evt = eg.ValueChangedEvent(self.GetId(), value=self.value)
     wx.PostEvent(self, evt)
Ejemplo n.º 4
0
 def OnButton(self, event):
     fontData = wx.FontData()
     fontData.EnableEffects(False)
     if self.value is not None:
         font = wx.FontFromNativeInfoString(self.value)
         fontData.SetInitialFont(font)
     else:
         fontData.SetInitialFont(
             wx.SystemSettings_GetFont(wx.SYS_ANSI_VAR_FONT))
     dialog = wx.FontDialog(self.GetParent(), fontData)
     if dialog.ShowModal() == wx.ID_OK:
         fontData = dialog.GetFontData()
         font = fontData.GetChosenFont()
         self.value = font.GetNativeFontInfo().ToString()
         event.Skip()
     dialog.Destroy()
     evt = eg.ValueChangedEvent(self.GetId(), value=self.value)
     wx.PostEvent(self, evt)
Ejemplo n.º 5
0
 def OnScrollChanged(self, event=None):
     d = {"1": self.slider.GetValue()}
     self.valueLabelCtrl.SetLabel(self.valueLabel % d)
     if event:
         wx.PostEvent(self, eg.ValueChangedEvent(self.GetId()))
Ejemplo n.º 6
0
 def OnSavePointLeft(self, event):
     self.Bind(EVT_STC_MODIFIED, self.OnModified)
     wx.PostEvent(self, eg.ValueChangedEvent(self.GetId()))
     event.Skip()
Ejemplo n.º 7
0
 def OnModified(self, event):
     wx.PostEvent(self, eg.ValueChangedEvent(self.GetId()))
     event.Skip()