コード例 #1
0
ファイル: subcellularatlas.py プロジェクト: connoryang/1v1dec
 def setup_layout(self):
     self.dialogue_container = uiprimitives.Container(name='dialogue_container', parent=self.parent, idx=0)
     self.left_main_container = uiprimitives.Container(name='left_main_container', parent=self, align=uiconst.TOLEFT_PROP, width=0.5, clipChildren=True, top=20)
     self.category_container = uiprimitives.Container(name='category_container', parent=self, align=uiconst.TOLEFT_PROP, width=0.5, padTop=45, clipChildren=True)
     self.loading_container = uiprimitives.Container(name='loadingContainer', parent=self.category_container, align=uiconst.CENTER, width=100, height=100, state=uiconst.UI_HIDDEN)
     self.loading_result_label = themeColored.LabelThemeColored(name='loadingResultLabel', parent=self.loading_container, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/ProjectDiscovery/LoadingResultLabel'), fontsize=20)
     self.loading_wheel = LoadingWheel(name='ResultLoadingIndicator', parent=self.loading_container, align=uiconst.CENTER, width=64, height=64)
     self.error_container = uiprimitives.Container(parent=self.category_container, align=uiconst.CENTER, width=100, height=100, state=uiconst.UI_HIDDEN)
     self.error_label = themeColored.LabelThemeColored(parent=self.error_container, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/ProjectDiscovery/LoadingResultErrorLabel'), fontsize=20)
     self.task_label = themeColored.LabelThemeColored(parent=self.left_main_container, align=uiconst.CENTERTOP, text=localization.GetByLabel('UI/ProjectDiscovery/TaskLabel'), top=40, fontsize=28, opacity=1)
     self.task_image = TaskImage(label=const.Texts.TaskImageLabel, parent=self.left_main_container, align=uiconst.TOPLEFT_PROP, pos=(25, 80, 420, 445), starting_scale=self.starting_scale)
     self.checkbox_container = uiprimitives.Container(name='checkboxContainer', parent=self.task_image, align=uiconst.BOTTOMLEFT, width=110, height=20, left=8, top=10)
     self.report_checkbox = uicontrols.Checkbox(name='reportCheckbox', parent=self.checkbox_container, text=localization.GetByLabel('UI/ProjectDiscovery/ReportCheckboxLabel'))
     SetTooltipHeaderAndDescription(self.report_checkbox, headerText=localization.GetByLabel('UI/ProjectDiscovery/AbnormalSampleTooltipHeader'), descriptionText=localization.GetByLabel('UI/ProjectDiscovery/AbnormalSampleTooltipDescription'))
     self.result_window = ResultWindow(name='ResultWindow', parent=self.parent, align=uiconst.TOALL, opacity=0, isTrainingPhase=False, starting_scale=self.starting_scale, bottom_container=self.bottom_container)
     self.rewards_view = RewardsView(parent=self.parent.parent, opacity=0, align=uiconst.TOALL, playerState=self.playerState, bottom_container=self.bottom_container, idx=1, state=uiconst.UI_DISABLED)
     self.processing_view = ProcessingView(parent=self.parent.parent, opacity=0, idx=2, state=uiconst.UI_DISABLED)
     self.category_selector = CategorySelector(categories=nested_categories_from_json(PROJECT_INFO['info']['classes']), parent=self.category_container, state=uiconst.UI_DISABLED, starting_scale=self.starting_scale)
     self.main_button_container = uiprimitives.Container(name='main_button_container', parent=self.bottom_container, align=uiconst.CENTERBOTTOM, width=355, height=53, bgTexturePath='res:/UI/Texture/classes/ProjectDiscovery/footerBG.png')
     self.submit_button_container = uiprimitives.Container(name='submitButtonContainer', parent=self.main_button_container, width=250, align=uiconst.CENTER, height=40, top=5)
     self.submit_button = uicontrols.Button(name='SubcellularSubmitButton', parent=self.submit_button_container, align=uiconst.CENTER, label=localization.GetByLabel('UI/ProjectDiscovery/SubmitButtonLabel'), fontsize=18, fixedwidth=170, fixedheight=30, func=lambda x: self.submit_solution())
     uiprimitives.Sprite(parent=self.submit_button_container, align=uiconst.CENTERLEFT, width=34, height=20, texturePath='res:/UI/Texture/classes/ProjectDiscovery/submitArrow.png', opacity=0.7)
     uiprimitives.Sprite(parent=uiprimitives.Transform(parent=self.submit_button_container, align=uiconst.CENTERRIGHT, width=34, height=20, rotation=math.pi), align=uiconst.CENTERRIGHT, width=34, height=20, texturePath='res:/UI/Texture/classes/ProjectDiscovery/submitArrow.png', opacity=0.7)
     self.task_id = uicontrols.Label(name='TaskID', parent=self.bottom_container, align=uiconst.BOTTOMRIGHT, height=20, opacity=0, left=10)
     self.new_task_button = uicontrols.ButtonIcon(name='newTaskButton', parent=self.left_main_container, align=uiconst.TOPLEFT, texturePath='res:/UI/Texture/classes/ProjectDiscovery/recycleButtonUp.png', hoverTexture='res:/UI/Texture/classes/ProjectDiscovery/recycleButtonOver.png', downTexture='res:/UI/Texture/classes/ProjectDiscovery/recycleButtonDown.png', iconSize=24, func=lambda : self.reset_and_get_new_task(), idx=0, left=32, top=54)
     SetTooltipHeaderAndDescription(self.new_task_button, headerText='', descriptionText=localization.GetByLabel('UI/ProjectDiscovery/NewTaskButtonTooltipDescription'))
コード例 #2
0
ファイル: attributePanel.py プロジェクト: connoryang/1v1dec
 def AddAttributeCont(self, attribute, parentGrid, attributeID=None):
     if attributeID is None:
         attributeID = attribute.attributeID
     iconSize = 32
     attributeCont = self.GetValueCont(iconSize)
     parentGrid.AddCell(cellObject=attributeCont)
     icon = Icon(graphicID=attribute.iconID,
                 pos=(3, 0, iconSize, iconSize),
                 hint=attribute.displayName,
                 name=attribute.displayName,
                 ignoreSize=True,
                 state=uiconst.UI_DISABLED)
     attributeCont.AddCell(cellObject=icon)
     label = EveLabelMedium(text='',
                            left=0,
                            state=uiconst.UI_DISABLED,
                            align=uiconst.CENTERLEFT)
     attributeCont.AddCell(cellObject=label)
     attributeCont.hint = attribute.displayName
     tooltipTitleID = attribute.tooltipTitleID
     if tooltipTitleID:
         tooltipTitle = GetByMessageID(tooltipTitleID)
         tooltipDescr = GetByMessageID(attribute.tooltipDescriptionID)
         SetTooltipHeaderAndDescription(targetObject=attributeCont,
                                        headerText=tooltipTitle,
                                        descriptionText=tooltipDescr)
     self.statsLabelsByIdentifier[attributeID] = label
     self.statsIconsByIdentifier[attributeID] = icon
     self.statsContsByIdentifier[attributeID] = attributeCont
     return (icon, label, attributeCont)
コード例 #3
0
    def ApplyAttributes(self, attributes):
        super(CategoryGroup, self).ApplyAttributes(attributes)
        category = attributes.get('category')
        number = attributes.get('number')
        self.starting_scale = attributes.get('starting_scale')
        self.sub_categories = []
        self.label = uicontrols.Label(name='categorygrouplabel', text=category['name'].upper(), parent=self, color=(1, 1, 1, 0.5), top=4, left=self.HEX_WIDTH, opacity=0, fontSize=20)
        self.original_label_fontsize = self.label.fontsize
        self.original_label_left = self.label.left
        self.original_label_top = self.label.top
        SetTooltipHeaderAndDescription(targetObject=self, headerText=category['name'], descriptionText=category['description'])
        self.category_group_hex = CategoryGroupHexagon(parent=self, category=category, number=number, top=0, left=0, width=self.HEX_WIDTH, height=self.HEX_HEIGHT, opacity=0, starting_scale=self.starting_scale)
        count = 1
        left = -self.HEX_SPACING
        self.width = self.HEX_WIDTH
        for subcat in category['children']:
            for cat in subcat['children']:
                pos = count % 3
                count += 1
                if pos is not 0:
                    left += self.HEX_SPACING
                    self.width += self.HEX_WIDTH
                self.sub_categories.append(CategoryHexagon(parent=self, category=cat, top=self.TOP_OFFSET[pos] + self.CHAIN_TOP_OFFSET, left=left, width=self.HEX_WIDTH, height=self.HEX_HEIGHT, opacity=0, starting_scale=self.starting_scale))

        if number == 3:
            self.width = 78
        else:
            self.width = self.width if self.width >= self.MIN_WIDTH else self.MIN_WIDTH
        self.default_width = self.width
        self.resize_to_scale(self.starting_scale)
コード例 #4
0
 def submit_training_solution(self):
     if self.isSubmitting:
         return
     if not self.selection:
         self.open_error_dialogue()
         return
     self.isSubmitting = True
     self.finishedTaskCount += 1
     sm.GetService('audio').SendUIEvent(const.Sounds.MainImageLoopStop)
     classification = list(
         set([cat['id'] for cat in self.selection if not cat['excluded']]))
     self.result = {
         'playerSelection': classification,
         'task': {
             'solution': self.task['solution']
         }
     }
     SetTooltipHeaderAndDescription(targetObject=self.explanation_icon,
                                    headerText='',
                                    descriptionText=self.explanation)
     self.result_window.assign_result(self.result)
     self.training_category_selector.cascade_categories_out()
     self.training_category_selector.state = uiconst.UI_DISABLED
     animations.FadeOut(self.main_button_container)
     animations.FadeOut(self.training_task_image.colorFilterContainer)
     animations.FadeOut(self.task_label)
     animations.FadeOut(self.refresh_task_button)
     self.training_task_image.start_transmission_animation()
     self.left_main_container.state = uiconst.UI_DISABLED
     self.category_container.state = uiconst.UI_DISABLED
     self.main_button_container.state = uiconst.UI_DISABLED
コード例 #5
0
ファイル: statsPanel.py プロジェクト: connoryang/1v1dec
 def ConstructNameCaption(self):
     self.nameCaptionCont = Container(name='shipname', parent=self, align=uiconst.TOTOP, height=12, padBottom=6)
     self.nameCaption = EveLabelMedium(text='', parent=self.nameCaptionCont, width=250, autoFitToText=True, state=uiconst.UI_NORMAL)
     SetTooltipHeaderAndDescription(targetObject=self.nameCaption, headerText='', descriptionText=GetByLabel('Tooltips/FittingWindow/ShipName_description'))
     self.nameCaption.GetDragData = GetFittingDragData
     self.infolink = InfoIcon(left=0, top=0, parent=self.nameCaptionCont, idx=0)
     self.UpdateShipName()
コード例 #6
0
ファイル: window.py プロジェクト: connoryang/1v1dec
 def update_analysis_kredits(self, player_state):
     self.playerState = player_state
     SetTooltipHeaderAndDescription(
         targetObject=self.rankIcon,
         headerText=localization.GetByLabel(
             'UI/ProjectDiscovery/AnalystRankTooltip'),
         descriptionText=localization.GetByLabel(
             'UI/ProjectDiscovery/AnalysisKreditsLabel') + ': ' +
         str(FmtAmt(self.playerState.analysisKredits)))
コード例 #7
0
def SetFittingTooltipInfo(targetObject, tooltipName, includeDesc = True):
    labelPaths = tooltipLabelPathDict.get(tooltipName, None)
    if not labelPaths:
        LogError('no valid labelpath for tooltipName=', tooltipName)
        return
    headerLabelPath, descriptionLabelPath = labelPaths
    if includeDesc and descriptionLabelPath:
        descriptionText = localization.GetByLabel(descriptionLabelPath)
    else:
        descriptionText = ''
    headerText = localization.GetByLabel(headerLabelPath)
    return SetTooltipHeaderAndDescription(targetObject, headerText, descriptionText)
コード例 #8
0
 def Load(self, attributeValues, mouseExitFunc=None, onClickFunc=None):
     if not attributeValues:
         return
     self.attributeValues = attributeValues
     self.innerContainers = {}
     self.Flush()
     containerPercentage = 1.0 / len(attributeValues)
     for attributeID, value in attributeValues:
         innerCont = Container(parent=self,
                               name='container_%s' % attributeID,
                               width=containerPercentage,
                               align=uiconst.TOLEFT_PROP,
                               clipChildren=True)
         self.innerContainers[attributeID] = innerCont
         iconCont = Container(parent=innerCont,
                              name='iconCont',
                              width=self.iconSize,
                              align=uiconst.TOLEFT,
                              state=uiconst.UI_PICKCHILDREN)
         icon = Icon(parent=iconCont,
                     pos=(0, 0, self.iconSize, self.iconSize),
                     align=uiconst.CENTERLEFT,
                     idx=0,
                     ignoreSize=True,
                     state=uiconst.UI_NORMAL)
         if mouseExitFunc:
             icon.OnMouseExit = mouseExitFunc
         if onClickFunc:
             icon.OnClick = (onClickFunc, attributeID)
         labelText = value or '-'
         innerCont.label = EveLabelSmall(parent=innerCont,
                                         text=labelText,
                                         align=uiconst.CENTERLEFT,
                                         left=self.iconSize)
         attributeInfo = cfg.dgmattribs.Get(attributeID)
         iconID = attributeInfo.iconID
         icon.LoadIcon(iconID, ignoreSize=True)
         icon.hint = attributeInfo.displayName
         tooltipTitleText, tooltipDescriptionText = GetAttributeTooltipTitleAndDescription(
             attributeID)
         if tooltipDescriptionText:
             SetTooltipHeaderAndDescription(
                 targetObject=icon,
                 headerText=tooltipTitleText,
                 descriptionText=tooltipDescriptionText)
コード例 #9
0
ファイル: window.py プロジェクト: connoryang/1v1dec
 def setup_layout(self):
     self.setup_side_panels()
     self.bottom_container = uiprimitives.Container(name='bottom_container',
                                                    parent=self.sr.main,
                                                    align=uiconst.TOBOTTOM,
                                                    height=50)
     self.project_container = uiprimitives.Container(
         name='ProjectContainer',
         parent=self.main,
         align=uiconst.TOPLEFT,
         height=self.default_minSize[1],
         width=self.default_minSize[0],
         top=-20)
     self.original_project_height = self.project_container.height
     self.original_project_width = self.project_container.width
     self.show_background_grid()
     self.header = WindowHeader(
         parent=self.main.parent,
         align=uiconst.CENTERTOP,
         height=53,
         width=355,
         idx=0,
         top=2,
         bgTexturePath=
         'res:/UI/Texture/classes/ProjectDiscovery/headerBG.png',
         playerState=self.playerState,
         playerStatistics=self.player_statistics)
     self.help_button = uicontrols.ButtonIcon(
         name='helpButton',
         parent=self.bottom_container,
         align=uiconst.BOTTOMLEFT,
         iconSize=22,
         width=22,
         height=22,
         texturePath='res:/UI/Texture/WindowIcons/question.png',
         func=lambda: self.start_tutorial())
     SetTooltipHeaderAndDescription(
         targetObject=self.help_button,
         headerText='',
         descriptionText=localization.GetByLabel(
             'UI/ProjectDiscovery/HelpTutorialTooltip'))
     uthread.new(self.animate_background)
コード例 #10
0
ファイル: window.py プロジェクト: connoryang/1v1dec
 def setup_layout(self):
     self.headerContainer = uiprimitives.Container(name='headerContainer',
                                                   parent=self,
                                                   align=uiconst.CENTERTOP,
                                                   height=34,
                                                   width=230)
     self.scoreBarContainer = uiprimitives.Container(
         name='scoreBarContainer',
         parent=self,
         align=uiconst.CENTERBOTTOM,
         height=8,
         width=self.headerContainer.width - 10,
         bgColor=(0.62, 0.54, 0.53, 0.26),
         top=10)
     self._initialize_score_bar_length()
     self.scoreBar = uicls.VectorLine(
         name='scoreBar',
         parent=self.scoreBarContainer,
         align=uiconst.CENTERLEFT,
         translationFrom=(0, 0),
         translationTo=(self.calculate_score_bar_length(), 0),
         colorFrom=(1.0, 1.0, 1.0, 0.95),
         colorTo=(1.0, 1.0, 1.0, 0.95),
         widthFrom=3,
         widthTo=3,
         left=3)
     uicls.VectorLine(name='emptyScoreBar',
                      parent=self.scoreBarContainer,
                      align=uiconst.CENTERLEFT,
                      translationFrom=(0, 0),
                      translationTo=(self.scoreBarLength, 0),
                      colorFrom=(0.0, 0.0, 0.0, 0.75),
                      colorTo=(0.0, 0.0, 0.0, 0.75),
                      widthFrom=3,
                      widthTo=3,
                      left=5)
     self.rankInfoContainer = uiprimitives.Container(
         name='rankInfoContainer',
         parent=self.headerContainer,
         align=uiconst.TOLEFT,
         width=75,
         top=3)
     self.rankIcon = uiprimitives.Sprite(
         name='rankIcon',
         parent=self.rankInfoContainer,
         texturePath=self.get_rank_icon_path(),
         height=36,
         width=36,
         align=uiconst.TOLEFT,
         left=5)
     SetTooltipHeaderAndDescription(
         targetObject=self.rankIcon,
         headerText=localization.GetByLabel(
             'UI/ProjectDiscovery/AnalystRankTooltip'),
         descriptionText=localization.GetByLabel(
             'UI/ProjectDiscovery/AnalysisKreditsLabel') + ': ' +
         str(FmtAmt(self.playerState.analysisKredits)))
     self.rankLabel = uicontrols.Label(parent=self.rankInfoContainer,
                                       fontsize=16,
                                       text=self.rank,
                                       align=uiconst.CENTERLEFT,
                                       height=20,
                                       left=40)
     self.accuracyRatingContainer = uiprimitives.Container(
         name='accuracyRatingContainer',
         parent=self.headerContainer,
         align=uiconst.TORIGHT,
         width=75,
         left=5,
         top=3)
     self.accuracyRatingIconContainer = uiprimitives.Container(
         name='accuracyRatingIconContainer',
         parent=self.accuracyRatingContainer,
         height=32,
         width=32,
         align=uiconst.CENTER,
         left=20,
         bgTexturePath=
         'res:/UI/Texture/classes/ProjectDiscovery/accuracyMeterBack.png')
     self.emptySprite = uiprimitives.Sprite(
         name='emptySprite',
         parent=self.accuracyRatingIconContainer,
         width=32,
         height=32,
         align=uiconst.CENTER)
     SetTooltipHeaderAndDescription(
         targetObject=self.emptySprite,
         headerText='',
         descriptionText=localization.GetByLabel(
             'UI/ProjectDiscovery/AccuracyRatingTooltip'))
     self.accuracyNeedleIconContainer = uiprimitives.Transform(
         parent=self.accuracyRatingIconContainer,
         height=32,
         width=32,
         align=uiconst.TORIGHT,
         rotation=0)
     self.accuracyNeedleIcon = uiprimitives.Sprite(
         name='accuracyNeedleIcon',
         parent=self.accuracyNeedleIconContainer,
         texturePath=
         'res:/UI/Texture/classes/ProjectDiscovery/accuracyMeterNeedle.png',
         width=32,
         height=32,
         rotation=2.4,
         align=uiconst.CENTER)
     self.accuracyArcFill = uicls.Polygon(
         parent=self.accuracyRatingIconContainer, align=uiconst.CENTER)
     self.accuracyArcFill.MakeArc(radius=0,
                                  outerRadius=10,
                                  fromDeg=-225.0,
                                  toDeg=-225.0,
                                  outerColor=(1.0, 1.0, 0, 0.7),
                                  innerColor=(1.0, 1.0, 0, 0.7))
     self.accuracyRatingLabel = uicontrols.Label(
         name='AccuracyRating',
         parent=self.accuracyRatingContainer,
         fontsize=16,
         text='00,0%',
         align=uiconst.CENTERLEFT,
         autoFitToText=True,
         height=20)
     self.state = uiconst.UI_NORMAL