示例#1
0
    def SetupUi(self):
        self.notifydata = []
        notificationList = [
            'shield', 'armour', 'hull', 'capacitor', 'cargoHold'
        ]
        for name in notificationList:
            notification = SoundNotification(name)
            data = {
                'checkboxLabel':
                localization.GetByLabel(notification.localizationLabel),
                'checkboxName':
                name + 'Notification',
                'checkboxSetting':
                notification.activeFlagSettingsName,
                'checkboxDefault':
                notification.defaultStatus,
                'sliderName':
                name,
                'sliderSetting':
                (name + 'Threshold', ('user', 'notifications'),
                 notification.defaultThreshold)
            }
            self.notifydata.append(data)

        labelWidth = 180
        mainContainer = uiprimitives.Container(name='mainContainer',
                                               parent=self.sr.main,
                                               align=uiconst.TOALL)
        for each in self.notifydata:
            name = each['sliderName']
            notifytop = uiprimitives.Container(name='notifytop',
                                               parent=mainContainer,
                                               align=uiconst.TOTOP,
                                               pos=(const.defaultPadding,
                                                    const.defaultPadding, 0,
                                                    32))
            uicontrols.Checkbox(text=each['checkboxLabel'],
                                parent=notifytop,
                                configName=each['checkboxSetting'],
                                retval=None,
                                prefstype=('user', 'notifications'),
                                checked=settings.user.notifications.Get(
                                    each['checkboxSetting'],
                                    each['checkboxDefault']),
                                callback=self.CheckBoxChange,
                                align=uiconst.TOLEFT,
                                pos=(const.defaultPadding, 0, labelWidth, 0))
            _par = uiprimitives.Container(name=name + '_slider',
                                          align=uiconst.TORIGHT,
                                          width=labelWidth,
                                          parent=notifytop,
                                          pos=(10, 0, 160, 0))
            par = uiprimitives.Container(name=name + '_slider_sub',
                                         align=uiconst.TOTOP,
                                         parent=_par,
                                         pos=(0, const.defaultPadding, 0, 10))
            slider = uicontrols.Slider(parent=par,
                                       gethintfunc=self.GetSliderHint,
                                       endsliderfunc=self.SliderChange)
            slider.Startup(name, 0.0, 1.0, each['sliderSetting'])
示例#2
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     sliderWidth = attributes.sliderWidth or 100
     config = attributes.config
     sliderParent = Container(name=config[0] + '_slider_sub',
                              parent=self,
                              align=uiconst.TOPRIGHT,
                              pos=(0, 0, sliderWidth, self.BASESIZE))
     slider = uicontrols.Slider(parent=sliderParent,
                                width=self.BASESIZE,
                                height=self.BASESIZE,
                                name=config[0],
                                hint=attributes.hint)
     if attributes.header:
         self.headerLabel = EveLabelSmall(text=attributes.header,
                                          parent=self,
                                          padRight=sliderWidth + 6,
                                          state=uiconst.UI_PICKCHILDREN,
                                          align=uiconst.TOTOP)
         self.headerLabel.OnSizeChanged = self.OnHeaderSizeChanged
     slider.GetSliderValue = attributes.GetSliderValue
     slider.SetSliderLabel = attributes.SetSliderLabel
     slider.GetSliderHint = attributes.GetSliderHint
     slider.EndSetSliderValue = attributes.EndSliderValue
     slider.Startup(config[0], attributes.minval, attributes.maxval, config)
示例#3
0
 def AddSlider(self, where, config, minval, maxval, header, hint = '', startVal = 0):
     h = 10
     _par = uiprimitives.Container(name=config + '_slider', parent=where, align=uiconst.TOTOP, pos=(0, 0, 124, 10), padding=(0, 0, 0, 0))
     par = uiprimitives.Container(name=config + '_slider_sub', parent=_par, align=uiconst.TOPLEFT, pos=(0, 0, 124, 10), padding=(0, 0, 0, 0))
     slider = uicontrols.Slider(parent=par)
     lbl = uicontrols.EveLabelSmall(text='bla', parent=par, align=uiconst.TOPLEFT, width=200, left=-34, top=0)
     setattr(self.sr, '%sLabel' % config, lbl)
     lbl.name = 'label'
     slider.SetSliderLabel = self.SetSliderLabel
     lbl.state = uiconst.UI_HIDDEN
     slider.Startup(config, minval, maxval, None, header, startVal=startVal)
     if startVal < minval:
         startVal = minval
     slider.value = startVal
     slider.name = config
     slider.hint = hint
     slider.OnSetValue = self.OnSetValue
     return slider