Skip to content

Commit

Permalink
add weight option to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Aranuvir committed Jun 27, 2018
1 parent 965e059 commit 83a2911
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions makehuman/core/mhmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def __init__(self):
'highspeed': 5,
'realtimeNormalUpdates': False,
'units': 'metric',
'real_weight': False,
'guiTheme': 'makehuman',
'restoreWindowSize': True,
'windowGeometry': ''
Expand All @@ -245,6 +246,7 @@ def __init__(self):
'lowspeed': 1,
'highspeed': 5,
'units':'metric',
'real_weight': False,
'invertMouseWheel':False,
'language':'english',
'excludePlugins':[],
Expand Down
24 changes: 23 additions & 1 deletion makehuman/plugins/5_settings_0_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,23 @@ def updateSliderImages(selected):
self.sliderImages = sliderBox.addWidget(SettingCheckbox("Slider images", 'sliderImages', updateSliderImages))

modes = []
unitBox = self.unitsBox = self.addLeftWidget(gui.GroupBox('Units'))
unitBox = self.addLeftWidget(gui.GroupBox('Units'))
self.metric = unitBox.addWidget(gui.RadioButton(modes, 'Metric', gui3d.app.getSetting('units') == 'metric'))
self.imperial = unitBox.addWidget(gui.RadioButton(modes, 'Imperial', gui3d.app.getSetting('units') == 'imperial'))

weights = []
weightBox = self.addLeftWidget(gui.GroupBox('Weight'))
self.rel_weight = weightBox.addWidget(gui.RadioButton(weights, 'Relative Weight', not gui3d.app.getSetting('real_weight')))
self.real_weight = weightBox.addWidget(gui.RadioButton(weights, 'Real Weight', gui3d.app.getSetting('real_weight')))

startupBox = self.addLeftWidget(gui.GroupBox('Startup'))
self.preload = startupBox.addWidget(SettingCheckbox("Preload macro targets", 'preloadTargets'))

self.saveScreenSize = startupBox.addWidget(SettingCheckbox("Restore window size", 'restoreWindowSize'))

resetBox = self.addLeftWidget(gui.GroupBox('Restore settings'))
self.resetButton = resetBox.addWidget(gui.Button("Restore to defaults"))

@self.resetButton.mhEvent
def onClicked(event):
gui3d.app.resetSettings()
Expand Down Expand Up @@ -184,6 +190,14 @@ def onClicked(event):
gui3d.app.setSetting('units', 'imperial')
gui3d.app.loadGrid()

@self.rel_weight.mhEvent
def onClicked(event):
gui3d.app.setSetting('real_weight', False)

@self.real_weight.mhEvent
def onClicked(event):
gui3d.app.setSetting('real_weight', True)

self.updateGui()

def updateGui(self):
Expand All @@ -199,6 +213,14 @@ def updateGui(self):
gui3d.app.setSetting('units', 'imperial')
gui3d.app.loadGrid()

use_real_weight = gui3d.app.getSetting('real_weight')
if use_real_weight:
self.real_weight.setChecked(True)
gui3d.app.setSetting('real_weight', True)
else:
self.rel_weight.setChecked(True)
gui3d.app.setSetting('real_weight', False)

lang = gui3d.app.getSetting('language')
for radioBtn in self.languageBox.children:
if radioBtn.language == lang:
Expand Down

0 comments on commit 83a2911

Please sign in to comment.