Commit 1798313f authored by Guillaume Seguin's avatar Guillaume Seguin

Add spin field to set speed factor #526

parent 62f52225
...@@ -192,7 +192,9 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -192,7 +192,9 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
root.speed_slider = wx.Slider(speedpanel, -1, 100, 1, 300) root.speed_slider = wx.Slider(speedpanel, -1, 100, 1, 300)
speedsizer.Add(root.speed_slider, 1, flag = wx.EXPAND) speedsizer.Add(root.speed_slider, 1, flag = wx.EXPAND)
root.speed_label = wx.StaticText(speedpanel, -1, _("%d%%") % 100) root.speed_spin = FloatSpin(speedpanel, -1, value = 100, min_val = 1, max_val = 300, digits = 0, style = wx.ALIGN_LEFT, size = (60, -1))
speedsizer.Add(root.speed_spin, 0, flag = wx.ALIGN_CENTER_VERTICAL)
root.speed_label = wx.StaticText(speedpanel, -1, _("%"))
speedsizer.Add(root.speed_label, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) speedsizer.Add(root.speed_label, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
def speedslider_set(event): def speedslider_set(event):
...@@ -204,10 +206,16 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -204,10 +206,16 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
speedpanel.SetSizer(speedsizer) speedpanel.SetSizer(speedsizer)
add("speedcontrol", speedpanel, flag = wx.EXPAND) add("speedcontrol", speedpanel, flag = wx.EXPAND)
def speedslider_spin(event):
value = root.speed_spin.GetValue()
root.speed_setbtn.SetBackgroundColour("red")
root.speed_slider.SetValue(value)
root.speed_spin.Bind(wx.EVT_SPINCTRL, speedslider_spin)
def speedslider_scroll(event): def speedslider_scroll(event):
value = root.speed_slider.GetValue() value = root.speed_slider.GetValue()
root.speed_setbtn.SetBackgroundColour("red") root.speed_setbtn.SetBackgroundColour("red")
root.speed_label.SetLabel(_("%d%%") % value) root.speed_spin.SetValue(value)
root.speed_slider.Bind(wx.EVT_SCROLL, speedslider_scroll) root.speed_slider.Bind(wx.EVT_SCROLL, speedslider_scroll)
# Temperature gauges # # Temperature gauges #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment