예제 #1
0
    def SearchTree(self):
        self.searchThread = None
        self.filterString = self.searchInput.GetValue()
        if not self.filterString:
            self.searchResultParent.Hide()
            self.searchResultParent.Flush()
            return
        self.searchResultParent.Flush()
        res = []
        searchFor = self.filterString.lower()

        def Crawl(obj, path):
            if obj is self:
                return
            if searchFor in obj.name.lower():
                if path:
                    res.append((obj, path + '/ <b>' + obj.name + '</b>'))
                else:
                    res.append((obj, '<b>' + obj.name + '</b>'))
            if hasattr(obj, 'children'):
                for each in obj.children:
                    if path:
                        Crawl(each, path + '/' + obj.name)
                    else:
                        Crawl(each, obj.name)

        for root in uicore.uilib.rootObjects:
            Crawl(root, '')

        if res:
            for obj, path in res[:20]:
                label = Label(parent=self.searchResultParent,
                              align=uiconst.TOTOP,
                              text=path,
                              state=uiconst.UI_NORMAL,
                              padding=(10, 2, 10, 2))
                label._searchObj = obj
                label.hint = path
                label.OnClick = (self.OnSearchResultClick, obj)

            if len(res) > 20:
                Label(parent=self.searchResultParent,
                      align=uiconst.TOTOP,
                      text='and even more... (%s found)' % len(res),
                      padding=(10, 2, 10, 2))
        else:
            Label(parent=self.searchResultParent,
                  align=uiconst.TOTOP,
                  text='No Match!',
                  padding=(10, 3, 10, 3))
        self.searchResultParent.Show()
예제 #2
0
    def SearchTree(self):
        self.searchThread = None
        self.filterString = self.searchInput.GetValue()
        if not self.filterString:
            self.searchResultParent.Hide()
            self.searchResultParent.Flush()
            return
        self.searchResultParent.Flush()
        res = []
        searchFor = self.filterString.lower()

        def Crawl(obj, path):
            if obj is self:
                return
            if searchFor in obj.name.lower():
                if path:
                    res.append((obj, path + '/ <b>' + obj.name + '</b>'))
                else:
                    res.append((obj, '<b>' + obj.name + '</b>'))
            if hasattr(obj, 'children'):
                for each in obj.children:
                    if path:
                        Crawl(each, path + '/' + obj.name)
                    else:
                        Crawl(each, obj.name)

        for root in uicore.uilib.rootObjects:
            Crawl(root, '')

        if res:
            for obj, path in res[:20]:
                label = Label(parent=self.searchResultParent, align=uiconst.TOTOP, text=path, state=uiconst.UI_NORMAL, padding=(10, 2, 10, 2))
                label._searchObj = obj
                label.hint = path
                label.OnClick = (self.OnSearchResultClick, obj)

            if len(res) > 20:
                Label(parent=self.searchResultParent, align=uiconst.TOTOP, text='and even more... (%s found)' % len(res), padding=(10, 2, 10, 2))
        else:
            Label(parent=self.searchResultParent, align=uiconst.TOTOP, text='No Match!', padding=(10, 3, 10, 3))
        self.searchResultParent.Show()
예제 #3
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.SetWndIcon('res:/ui/Texture/WindowIcons/Settings.png', mainTop=-6)
     self.SetMainIconSize(64)
     self.width = 350
     self.height = 400
     self.MakeUnResizeable()
     self.currentComboValue = localization.settings.bilingualSettings.GetValue(
         'localizationImportantNames')
     WndCaptionLabel(
         text=GetByLabel('UI/LanguageWindow/BilingualFunctionalityHeader'),
         parent=self.sr.topParent,
         align=uiconst.RELATIVE)
     self.autoSizeMain = ContainerAutoSize(
         parent=self.sr.main,
         name='autoSizeMain',
         align=uiconst.TOTOP,
         callback=self.OnAutoSizeMainResize,
         padLeft=2,
         padRight=2)
     text = GetByLabel('UI/LanguageWindow/BodyText')
     EveLabelMedium(text=text,
                    parent=self.autoSizeMain,
                    align=uiconst.TOTOP,
                    padding=(10, 4, 10, 0))
     self.btnGroup = ButtonGroup(parent=self.sr.main, idx=0)
     self.btnGroup.AddButton(GetByLabel('UI/Commands/Apply'), self.Save)
     self.btnGroup.AddButton(GetByLabel('UI/Common/Close'), self.Cancel)
     grid = LayoutGrid(parent=self.autoSizeMain,
                       align=uiconst.TOTOP,
                       columns=2,
                       name='grid',
                       padTop=10,
                       padLeft=20,
                       cellSpacing=4)
     languageID = ConvertLanguageIDToMLS(session.languageID)
     self.currentLanguageString = GetByLabel(
         mlsToDisplayNamePaths[languageID])
     text = GetByLabel('UI/SystemMenu/Language/Display')
     comboLabel = EveLabelMedium(text=text,
                                 parent=grid,
                                 align=uiconst.TOPLEFT,
                                 state=uiconst.UI_NORMAL)
     comboLabel.hint = GetByLabel(
         'UI/SystemMenu/Language/ImportantNamesExplanation')
     options = [(self.currentLanguageString, 0),
                (GetByLabel('UI/SystemMenu/Language/EnglishReplacement'),
                 IMPORTANT_EN_OVERRIDE)]
     self.displayCombo = Combo(
         label='',
         parent=grid,
         options=options,
         name='displayCombo',
         select=self.currentComboValue,
         width=115,
         pos=(10, 0, 0, 0),
         align=uiconst.TOPLEFT,
         callback=self.OnComboChanged,
         hint=GetByLabel(
             'UI/SystemMenu/Language/ImportantNamesExplanation'))
     tooltipText = self.GetTooltipCheckboxText()
     checked = localization.settings.bilingualSettings.GetValue(
         'languageTooltip')
     self.tooltipCB = Checkbox(text=tooltipText,
                               parent=None,
                               configName='tooltipsCB',
                               checked=checked,
                               align=uiconst.TOPLEFT,
                               width=300)
     grid.AddCell(cellObject=self.tooltipCB, colSpan=grid.columns)
     hiliteImportantText = GetByLabel(
         'UI/SystemMenu/Language/HighlightImportantNames')
     checked = localization.settings.bilingualSettings.GetValue(
         'localizationHighlightImportant')
     self.importantCB = Checkbox(text=hiliteImportantText,
                                 parent=None,
                                 configName='importantNamesCB',
                                 checked=checked,
                                 align=uiconst.TOPLEFT,
                                 width=300)
     grid.AddCell(cellObject=self.importantCB, colSpan=grid.columns)
     text = localization.GetByLabel('UI/LanguageWindow/ChangeSettingsInEsc')
     EveLabelMedium(text=text,
                    parent=self.autoSizeMain,
                    align=uiconst.TOTOP,
                    padding=(10, 10, 10, 0))
     Line(parent=self.autoSizeMain,
          align=uiconst.TOTOP,
          color=(1, 1, 1, 0.1),
          padTop=4,
          padBottom=2)
     text = GetByLabel('UI/Messages/TxtSuppress2Body')
     self.suppressCb = Checkbox(text=text,
                                parent=self.autoSizeMain,
                                configName='importantNamesCB',
                                retval=0,
                                checked=0,
                                align=uiconst.TOTOP,
                                padLeft=6)