コード例 #1
0
 def UpdateOnlineDisplay(self):
     if self.controller.parentController.GetItemID(
     ) == self.controller.dogmaLocation.shipIDBeingDisembarked:
         return
     if self.controller.GetModule(
     ) is not None and self.controller.IsOnlineable():
         if self.controller.IsOnline():
             self.flagIcon.SetRGBA(1.0, 1.0, 1.0, 1.0)
             if GetAttrs(
                     self, 'sr', 'onlineButton'
             ) and self.sr.onlineButton.hint == localization.GetByLabel(
                     'UI/Fitting/PutOnline'):
                 self.sr.onlineButton.hint = localization.GetByLabel(
                     'UI/Fitting/PutOffline')
         else:
             self.flagIcon.SetRGBA(1.0, 1.0, 1.0, 0.25)
             if GetAttrs(
                     self, 'sr', 'onlineButton'
             ) and self.sr.onlineButton.hint == localization.GetByLabel(
                     'UI/Fitting/PutOffline'):
                 self.sr.onlineButton.hint = localization.GetByLabel(
                     'UI/Fitting/PutOnline')
     elif self.flagIcon:
         if self.controller.GetModule(
         ) is None or self.controller.SlotExists():
             self.flagIcon.SetRGBA(1.0, 1.0, 1.0, 1.0)
         else:
             self.flagIcon.SetRGBA(0.7, 0.0, 0.0, 0.5)
コード例 #2
0
 def SetWndDefaultFrameState(self, btns, on = 1):
     for btn in btns:
         if btn == self:
             continue
         frame = GetAttrs(btn, 'sr', 'defaultActiveFrame')
         if frame:
             frame.state = [uiconst.UI_HIDDEN, uiconst.UI_DISABLED][on == 1]
コード例 #3
0
 def SetWndDefaultFrameState(self, btns, on=1):
     for btn in btns:
         if btn == self:
             continue
         frame = GetAttrs(btn, 'sr', 'defaultActiveFrame')
         if frame:
             frame.state = [uiconst.UI_HIDDEN, uiconst.UI_DISABLED][on == 1]
コード例 #4
0
 def UpdateSettings(self):
     prefskey = self.prefskey
     if prefskey is None:
         return
     config = prefskey[-1]
     prefstype = prefskey[:-1]
     s = GetAttrs(settings, *prefstype)
     if s:
         s.Set(config, self.GetValue())
コード例 #5
0
ファイル: combo.py プロジェクト: connoryang/1v1dec
 def UpdateSettings(self):
     prefskey = self.prefskey
     if prefskey is None:
         return
     config = prefskey[-1]
     prefstype = prefskey[:-1]
     s = GetAttrs(settings, *prefstype)
     try:
         s.Set(config, self.GetValue())
     except:
         log.LogError('Failed to assign setting to: %s, %s' %
                      (prefstype, config))
コード例 #6
0
ファイル: slider.py プロジェクト: connoryang/1v1dec
 def OnHandleMouseUp(self, *args):
     uicore.uilib.UnclipCursor()
     self.dragging = 0
     if self.config:
         if len(self.config) == 3:
             cfgName, prefsType, defaultValue = self.config
             if prefsType:
                 si = GetAttrs(settings, *prefsType)
                 if si:
                     value = si.Set(cfgName, self.value)
         settings.user.ui.Set(self.config, self.value)
     if self.EndSetSliderValue:
         self.EndSetSliderValue(self)
コード例 #7
0
 def DoDblClickDay(self, day, *args):
     if GetAttrs(day, 'disabled'):
         monthday = day.monthday
         self.ChangeMonth(day.disabled, selectDay=0)
         self.CrawlForAndSetMonthday(monthday)
     else:
         day.OpenSingleDayWnd()
コード例 #8
0
 def UpdateSettings(self):
     prefstype = self.data.get('prefstype', None)
     if prefstype is None:
         return
     if self._groupName and not self._checked:
         return
     config = self.data.get('config', None)
     value = self.data.get('value', None)
     if value is None:
         value = self._checked
     s = GetAttrs(settings, *prefstype)
     try:
         s.Set(config, value)
     except:
         log.LogError('Failed to assign setting to: %s, %s' %
                      (prefstype, config))
コード例 #9
0
 def IsMoveAllowed(self, draggedNode, checkedIdx):
     queue = self.GetQueue()
     if checkedIdx is None:
         checkedIdx = len(queue)
     if draggedNode.skillID:
         if draggedNode.panel and draggedNode.panel.__guid__ == 'listentry.SkillEntry':
             level = self.FindNextLevel(draggedNode.skillID,
                                        draggedNode.skill.skillLevel, queue)
         else:
             level = draggedNode.Get('trainToLevel', 1)
             if draggedNode.inQueue is None:
                 level += 1
         return self.CheckCanInsertSkillAtPosition(draggedNode.skillID,
                                                   level,
                                                   checkedIdx,
                                                   check=1,
                                                   performLengthTest=False)
     if draggedNode.__guid__ in ('xtriui.InvItem', 'listentry.InvItem'):
         category = GetAttrs(draggedNode, 'rec', 'categoryID')
         if category != const.categorySkill:
             return
         typeID = GetAttrs(draggedNode, 'rec', 'typeID')
         if typeID is None:
             return
         skill = sm.StartService('skills').GetMySkillsFromTypeID(typeID)
         if skill:
             return False
         meetsReq = sm.StartService('godma').CheckSkillRequirementsForType(
             typeID)
         if not meetsReq:
             return False
         return True
     if draggedNode.__guid__ == 'listentry.SkillTreeEntry':
         typeID = draggedNode.typeID
         if typeID is None:
             return
         mySkills = sm.StartService('skills').GetMyGodmaItem().skills
         skill = mySkills.get(typeID, None)
         if skill is None:
             return
         skill = sm.StartService('skills').GetMySkillsFromTypeID(typeID)
         level = self.FindNextLevel(typeID, skill.skillLevel, queue)
         return self.CheckCanInsertSkillAtPosition(typeID,
                                                   level,
                                                   checkedIdx,
                                                   check=1,
                                                   performLengthTest=False)
コード例 #10
0
 def DoDblClickDay(self, day, *args):
     """
         this function overwrites the DoDblClickDay function of the day
     """
     if GetAttrs(day, 'disabled'):
         monthday = day.monthday
         self.ChangeMonth(day.disabled, selectDay=0)
         self.CrawlForAndSetMonthday(monthday)
     else:
         day.OpenSingleDayWnd()
コード例 #11
0
ファイル: settings.py プロジェクト: connoryang/1v1dec
 def Get(self, groupName, settingName):
     if groupName not in self.datastore:
         self.CreateGroup(groupName)
     if settingName in self.datastore[groupName]:
         value = self.datastore[groupName][settingName][1]
         self.datastore[groupName][settingName] = (
             blue.os.GetWallclockTime(), value)
         return value
     else:
         n = settingName
         if type(n) == types.UnicodeType:
             n = n.encode('UTF-8')
         return GetAttrs(defaultsetting, self._name, groupName, n)
コード例 #12
0
 def Get(self, groupName, settingName):
     """
     We keep track of last access for each entry - see FlushOldEntries below.
     """
     if groupName not in self.datastore:
         self.CreateGroup(groupName)
     if settingName in self.datastore[groupName]:
         value = self.datastore[groupName][settingName][1]
         self.datastore[groupName][settingName] = (
             blue.os.GetWallclockTime(), value)
         return value
     else:
         n = settingName
         if type(n) == types.UnicodeType:
             n = n.encode('UTF-8')
         return GetAttrs(defaultsetting, self._name, groupName, n)
コード例 #13
0
 def OnMouseExit(self, *args):
     if GetAttrs(self, 'sr', 'hilite'):
         self.sr.hilite.state = uiconst.UI_HIDDEN
コード例 #14
0
 def OnMouseEnter(self, *args):
     if GetAttrs(self, 'sr', 'hilite'):
         self.sr.hilite.state = uiconst.UI_DISABLED
コード例 #15
0
    def OnMouseEnterBestRepair(self, entry):
        for each in entry.parent.children:
            if GetAttrs(each, 'sr', 'hilite'):
                each.sr.hilite.state = uiconst.UI_HIDDEN

        entry.sr.hilite.state = uiconst.UI_DISABLED
コード例 #16
0
ファイル: slider.py プロジェクト: connoryang/1v1dec
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     if self.default_fontsize is None:
         self.default_fontsize = fontConst.DEFAULT_FONTSIZE
     self.value = None
     self.label = None
     self.top = 0
     self.dragging = 0
     self.handle = None
     self.handleOffset = 0
     self.increments = []
     increments = attributes.get('increments', self.default_increments)
     self.displayName = attributes.get('displayName',
                                       self.default_displayName)
     self.config = attributes.get('config', self.default_config)
     self.isEvenIncrementsSlider = attributes.get(
         'isEvenIncrementsSlider', False) and bool(increments)
     self.startVal = attributes.get('startVal', self.default_startVal)
     self.maxValue = attributes.get('maxValue', self.default_maxValue)
     self.minValue = attributes.get('minValue', self.default_minValue)
     self.sliderID = attributes.get('sliderID', self.default_sliderID)
     self.barHeight = attributes.get('barHeight', self.default_barHeight)
     self.barPadding = attributes.get('barPadding', self.default_barPadding)
     self.fontStyle = attributes.get('fontStyle', self.default_fontStyle)
     self.fontFamily = attributes.get('fontFamily', self.default_fontFamily)
     self.fontPath = attributes.get('fontPath', self.default_fontPath)
     self.fontsize = attributes.get('fontsize', self.default_fontsize)
     self.labeltab = attributes.get('labeltab', self.default_labeltab)
     self.SetSliderLabel = attributes.get('setlabelfunc',
                                          self.default_setlabelfunc)
     self.GetSliderValue = attributes.get('getvaluefunc',
                                          self.default_getvaluefunc)
     self.EndSetSliderValue = attributes.get('endsliderfunc',
                                             self.default_endsliderfunc)
     self.OnSetValue = attributes.get('onsetvaluefunc',
                                      self.default_onsetvaluefunc)
     self.showLabel = attributes.get('showLabel', self.default_showLabel)
     self.showValueInLabel = attributes.get('showValueInLabel',
                                            self.default_showValueInLabel)
     self.Prepare_Underlay_()
     self.Prepare_Handle_()
     self.Prepare_Label_()
     self.Prepare_Increments_()
     self.SetIncrements(increments)
     if self.config:
         if len(self.config) == 3:
             cfgName, prefsType, defaultValue = self.config
             if prefsType is not None:
                 si = GetAttrs(settings, *prefsType)
                 if si:
                     value = si.Get(cfgName, defaultValue)
                 else:
                     value = defaultValue
             else:
                 value = defaultValue
             self.name = self.config[0]
         else:
             value = settings.user.ui.Get(
                 self.config, (self.maxValue - self.minValue) * 0.5)
             if value is None:
                 value = 0.0
             self.name = self.config
         self.SetValue(value, updateHandle=True)
     elif self.startVal is not None:
         self.SetValue(self.startVal, updateHandle=True)
     else:
         self.state = uiconst.UI_NORMAL