Configtool: align labels and choices vertically.
wxPython apparently doesn't allow to do this automatically, so do it kind of manually, with a constand in data.py. --Traumflug
This commit is contained in:
parent
be8b0da71a
commit
cbc87fc526
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from configtool.data import BSIZESMALL
|
from configtool.data import BSIZESMALL, offsetChLabel, offsetTcLabel
|
||||||
|
|
||||||
|
|
||||||
class AddHeaterDlg(wx.Dialog):
|
class AddHeaterDlg(wx.Dialog):
|
||||||
|
|
@ -22,7 +22,7 @@ class AddHeaterDlg(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Heater Name:", size = (80, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Heater Name:", size = (80, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
|
|
||||||
self.tcName = wx.TextCtrl(self, wx.ID_ANY, "")
|
self.tcName = wx.TextCtrl(self, wx.ID_ANY, "")
|
||||||
self.tcName.SetFont(font)
|
self.tcName.SetFont(font)
|
||||||
|
|
@ -37,7 +37,7 @@ class AddHeaterDlg(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (80, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (80, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
|
|
||||||
self.chPin = wx.Choice(self, wx.ID_ANY, choices = pins)
|
self.chPin = wx.Choice(self, wx.ID_ANY, choices = pins)
|
||||||
self.chPin.SetFont(font)
|
self.chPin.SetFont(font)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from configtool.data import pinNames, BSIZESMALL, sensorTypes
|
from configtool.data import (pinNames, BSIZESMALL, sensorTypes, offsetTcLabel,
|
||||||
|
offsetChLabel)
|
||||||
|
|
||||||
|
|
||||||
class AddSensorDlg(wx.Dialog):
|
class AddSensorDlg(wx.Dialog):
|
||||||
|
|
@ -27,7 +28,7 @@ class AddSensorDlg(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Sensor Name:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Sensor Name:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
|
|
||||||
self.tcName = wx.TextCtrl(self, wx.ID_ANY, "")
|
self.tcName = wx.TextCtrl(self, wx.ID_ANY, "")
|
||||||
self.tcName.SetFont(font)
|
self.tcName.SetFont(font)
|
||||||
|
|
@ -43,7 +44,7 @@ class AddSensorDlg(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Sensor Type:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Sensor Type:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
|
|
||||||
sl = sorted(sensorTypes.keys())
|
sl = sorted(sensorTypes.keys())
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ class AddSensorDlg(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Pin:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
|
|
||||||
self.choiceList = pinNames
|
self.choiceList = pinNames
|
||||||
self.chPin = wx.Choice(self, wx.ID_ANY, choices = pins)
|
self.chPin = wx.Choice(self, wx.ID_ANY, choices = pins)
|
||||||
|
|
@ -78,7 +79,7 @@ class AddSensorDlg(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Additional:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Additional:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
|
|
||||||
self.tcAddtl = wx.TextCtrl(self, wx.ID_ANY, "")
|
self.tcAddtl = wx.TextCtrl(self, wx.ID_ANY, "")
|
||||||
self.tcAddtl.SetFont(font)
|
self.tcAddtl.SetFont(font)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from configtool.data import BSIZESMALL, reFloat, reInteger
|
from configtool.data import (BSIZESMALL, reFloat, reInteger, offsetChLabel,
|
||||||
|
offsetTcLabel)
|
||||||
|
|
||||||
|
|
||||||
class CalcBelt(wx.Dialog):
|
class CalcBelt(wx.Dialog):
|
||||||
|
|
@ -24,7 +25,7 @@ class CalcBelt(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Step Angle:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Step Angle:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
stepAngles = ["1.8 (200 per revolution)", "0.9 (400 per revolution)",
|
stepAngles = ["1.8 (200 per revolution)", "0.9 (400 per revolution)",
|
||||||
|
|
@ -45,7 +46,7 @@ class CalcBelt(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Microstepping:",
|
st = wx.StaticText(self, wx.ID_ANY, "Microstepping:",
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
microStepping = ["1 - full step", "1/2 - half step", "1/4 - quarter step",
|
microStepping = ["1 - full step", "1/2 - half step", "1/4 - quarter step",
|
||||||
|
|
@ -69,7 +70,7 @@ class CalcBelt(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Belt Pitch (in mm):",
|
st = wx.StaticText(self, wx.ID_ANY, "Belt Pitch (in mm):",
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
tc = wx.TextCtrl(self, wx.ID_ANY, "2", style = wx.TE_RIGHT)
|
tc = wx.TextCtrl(self, wx.ID_ANY, "2", style = wx.TE_RIGHT)
|
||||||
|
|
@ -100,7 +101,7 @@ class CalcBelt(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Pulley Teeth Count:",
|
st = wx.StaticText(self, wx.ID_ANY, "Pulley Teeth Count:",
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
tc = wx.TextCtrl(self, wx.ID_ANY, "8", style = wx.TE_RIGHT)
|
tc = wx.TextCtrl(self, wx.ID_ANY, "8", style = wx.TE_RIGHT)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
from configtool.data import BSIZESMALL, reFloat
|
from configtool.data import BSIZESMALL, reFloat, offsetChLabel, offsetTcLabel
|
||||||
|
|
||||||
|
|
||||||
class CalcScrew(wx.Dialog):
|
class CalcScrew(wx.Dialog):
|
||||||
|
|
@ -24,7 +24,7 @@ class CalcScrew(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Step Angle:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Step Angle:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
stepAngles = ["1.8 (200 per revolution)", "0.9 (400 per revolution)",
|
stepAngles = ["1.8 (200 per revolution)", "0.9 (400 per revolution)",
|
||||||
|
|
@ -45,7 +45,7 @@ class CalcScrew(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Microstepping:",
|
st = wx.StaticText(self, wx.ID_ANY, "Microstepping:",
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
microStepping = ["1 - full step", "1/2 - half step", "1/4 - quarter step",
|
microStepping = ["1 - full step", "1/2 - half step", "1/4 - quarter step",
|
||||||
|
|
@ -69,7 +69,7 @@ class CalcScrew(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Screw Pitch (mm/rev):",
|
st = wx.StaticText(self, wx.ID_ANY, "Screw Pitch (mm/rev):",
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
tc = wx.TextCtrl(self, wx.ID_ANY, "2", style = wx.TE_RIGHT)
|
tc = wx.TextCtrl(self, wx.ID_ANY, "2", style = wx.TE_RIGHT)
|
||||||
|
|
@ -104,7 +104,7 @@ class CalcScrew(wx.Dialog):
|
||||||
st = wx.StaticText(self, wx.ID_ANY, "Gear Ratio:", size = (labelWidth, -1),
|
st = wx.StaticText(self, wx.ID_ANY, "Gear Ratio:", size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(font)
|
st.SetFont(font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
lsz.AddSpacer((5, 5))
|
lsz.AddSpacer((5, 5))
|
||||||
|
|
||||||
tc = wx.TextCtrl(self, wx.ID_ANY, "1", size = (40, -1), style = wx.TE_RIGHT)
|
tc = wx.TextCtrl(self, wx.ID_ANY, "1", size = (40, -1), style = wx.TE_RIGHT)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
from sys import platform
|
||||||
|
|
||||||
|
|
||||||
supportedCPUs = ['ATmega168', 'ATmega328P', 'ATmega644', 'ATmega644P',
|
supportedCPUs = ['ATmega168', 'ATmega328P', 'ATmega644', 'ATmega644P',
|
||||||
|
|
@ -17,6 +18,13 @@ BSIZE = (90, 60)
|
||||||
BSIZESMALL = (90, 30)
|
BSIZESMALL = (90, 30)
|
||||||
|
|
||||||
|
|
||||||
|
if platform == "win32":
|
||||||
|
offsetTcLabel = 4
|
||||||
|
offsetChLabel = 4
|
||||||
|
else:
|
||||||
|
offsetTcLabel = 6
|
||||||
|
offsetChLabel = 8
|
||||||
|
|
||||||
TYPE_GENERAL = 0
|
TYPE_GENERAL = 0
|
||||||
TYPE_FLOAT = 1
|
TYPE_FLOAT = 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
from configtool.data import reInteger, reFloat
|
from configtool.data import reInteger, reFloat, offsetChLabel, offsetTcLabel
|
||||||
|
|
||||||
|
|
||||||
class Page:
|
class Page:
|
||||||
|
|
@ -31,7 +31,7 @@ class Page:
|
||||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name] + " ",
|
st = wx.StaticText(self, wx.ID_ANY, self.labels[name] + " ",
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(self.font)
|
st.SetFont(self.font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetTcLabel)
|
||||||
|
|
||||||
tc = wx.TextCtrl(self, wx.ID_ANY, "", style = wx.TE_RIGHT, name = name)
|
tc = wx.TextCtrl(self, wx.ID_ANY, "", style = wx.TE_RIGHT, name = name)
|
||||||
tc.SetFont(self.font)
|
tc.SetFont(self.font)
|
||||||
|
|
@ -68,7 +68,7 @@ class Page:
|
||||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(self.font)
|
st.SetFont(self.font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
|
|
||||||
ch = wx.Choice(self, wx.ID_ANY, choices = choices, size = size, name = name)
|
ch = wx.Choice(self, wx.ID_ANY, choices = choices, size = size, name = name)
|
||||||
ch.SetFont(self.font)
|
ch.SetFont(self.font)
|
||||||
|
|
@ -84,7 +84,7 @@ class Page:
|
||||||
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
st = wx.StaticText(self, wx.ID_ANY, self.labels[name],
|
||||||
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
size = (labelWidth, -1), style = wx.ALIGN_RIGHT)
|
||||||
st.SetFont(self.font)
|
st.SetFont(self.font)
|
||||||
lsz.Add(st)
|
lsz.Add(st, 1, wx.TOP, offsetChLabel)
|
||||||
|
|
||||||
if allowBlank:
|
if allowBlank:
|
||||||
opts = ["-"] + pins
|
opts = ["-"] + pins
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import os
|
import os
|
||||||
import wx
|
import wx
|
||||||
from configtool.data import BSIZESMALL
|
from configtool.data import BSIZESMALL, offsetTcLabel
|
||||||
|
|
||||||
INIFILE = "configtool.default.ini"
|
INIFILE = "configtool.default.ini"
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ class SettingsDlg(wx.Dialog):
|
||||||
t = wx.StaticText(self, wx.ID_ANY, f[0], size = (labelWidth, -1),
|
t = wx.StaticText(self, wx.ID_ANY, f[0], size = (labelWidth, -1),
|
||||||
style = wx.ALIGN_RIGHT)
|
style = wx.ALIGN_RIGHT)
|
||||||
t.SetFont(settings.font)
|
t.SetFont(settings.font)
|
||||||
lsz.Add(t)
|
lsz.Add(t, 1, wx.TOP, offsetTcLabel)
|
||||||
|
|
||||||
lsz.AddSpacer((8, 8))
|
lsz.AddSpacer((8, 8))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue