示例#1
0
    def __init__(self,
                 name,
                 title,
                 icon,
                 client,
                 dam,
                 hit,
                 arm,
                 gold,
                 desc=""):

        self.client = client
        self.name = name
        self.title = title
        icon = Graphic(path=['icons', icon])
        title = Label(self.title)
        gold = Label("%sg" % gold, color=[230, 244, 68, 255])
        stats = HorizontalContainer([
            Label(str(dam), color=[255, 100, 100, 255]),
            Label(str(hit), color=[100, 100, 255, 255]),
            Label(str(arm), color=[100, 255, 100, 255]),
        ])

        take_button = OneTimeButton(label='Take', on_release=self.take)

        HorizontalContainer.__init__(self,
                                     [icon, title, gold, stats, take_button],
                                     align=HALIGN_LEFT)
示例#2
0
    def __init__(self,
                 name,
                 title,
                 equipped,
                 icon,
                 client,
                 hit,
                 dam,
                 arm,
                 desc=""):

        self.client = client
        self.name = name
        self.title = title
        icon = Graphic(path=['icons', icon])
        title = Label(self.title)
        stats = HorizontalContainer([
            Label(str(dam), color=[255, 100, 100, 255]),
            Label(str(hit), color=[100, 100, 255, 255]),
            Label(str(arm), color=[100, 255, 100, 255]),
        ])
        button_text = 'Equip '
        if equipped:
            button_text = 'Remove'

        equip_button = Button(label=button_text,
                              is_pressed=equipped,
                              on_press=self.equip)
        use_button = OneTimeButton(label='Use', on_release=self.use)
        drop_button = OneTimeButton(label='Drop', on_release=self.confirm_drop)

        HorizontalContainer.__init__(
            self, [icon, title, stats, equip_button, use_button, drop_button],
            align=HALIGN_LEFT)
示例#3
0
    def __init__(self, title, align=HALIGN_CENTER):
        if align == HALIGN_LEFT:
            left_expand = False
            right_expand = True
        elif align == HALIGN_CENTER:
            left_expand = True
            right_expand = True
        else:  # HALIGN_RIGHT
            left_expand = True
            right_expand = False

        HorizontalContainer.__init__(self, content=[
            Graphic(path=["section", "left"], is_expandable=left_expand),
            Frame(Label(title, path=["section"]), path=['section', 'center']),
            Graphic(path=["section", "right"], is_expandable=right_expand),
            ], align=VALIGN_BOTTOM, padding=0)
示例#4
0
文件: gui.py 项目: JStation/omphalos
    def __init__(self, title, align=HALIGN_CENTER):
        if align == HALIGN_LEFT:
            left_expand = False
            right_expand = True
        elif align == HALIGN_CENTER:
            left_expand = True
            right_expand = True
        else:  # HALIGN_RIGHT
            left_expand = True
            right_expand = False

        HorizontalContainer.__init__(self, content=[
            Graphic(path=["section", "left"], is_expandable=left_expand),
            Frame(Label(title, path=["section"]), path=['section', 'center']),
            Graphic(path=["section", "right"], is_expandable=right_expand),
            ], align=VALIGN_BOTTOM, padding=0)