本文整理汇总了Python中client.ui.controls.Frame类的典型用法代码示例。如果您正苦于以下问题:Python Frame类的具体用法?Python Frame怎么用?Python Frame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
def update(self):
p = self.player
if not p: return
nick = p.account.username
if self.dropped:
if self.fleed:
prefix = u'(逃跑)'
else:
prefix = u'(掉线)'
nick = prefix + nick
self.caption = nick
char = self.character
if char:
meta = char.ui_meta
self.bg = meta.port_image
self.update_bg()
self.set_charname(meta.char_name)
if self._last_balloon != meta.description:
self.init_balloon(meta.description, (2, 74, 145, 96))
self._last_balloon = meta.description
self.bot_reserve = 74
self.gray_tex = None
Frame.update(self)
self.update_position()
self.update_color()
self.tagarrange()
示例2: update
def update(self):
p = self.player
if not p:
return
nick = u"<%s>" % p.account.username
if self.dropped:
if self.fleed:
prefix = u"(逃跑)"
else:
prefix = u"(掉线)"
nick = prefix + nick
self.caption = nick
char = self.character
if char:
meta = char.ui_meta
self.bg = L(meta.port_image)
self.update_bg()
self.set_charname(meta.name)
desc = char_desc(char)
if self._last_balloon != desc:
self.balloon.set_balloon(desc, (2, 74, 145, 96))
self._last_balloon = desc
self.bot_reserve = 74
self.gray_tex = None
Frame.update(self)
self.update_position()
self.update_color()
self.tagarrange()
示例3: __init__
def __init__(self, parent):
Frame.__init__(
self, x=35, y=20, width=240, height=180,
caption=u'帐号信息', parent=parent,
)
self.textarea = TextArea(
parent=self, x=2, y=10+2, width=240-4, height=180-24-2-10
)
示例4: batch_draw
def batch_draw(gcps):
glPushMatrix()
glLoadIdentity()
Frame.batch_draw(gcps)
GameCharacterPortrait.batch_draw_status(gcps)
glPopMatrix()
cl = []
map(cl.extend, [p.control_list for p in gcps])
Control.do_draw(cl)
示例5: _fill_batch
def _fill_batch(self, batch):
Frame._fill_batch(self, batch)
self._gcp_framevlist = batch.add(16, GL_QUADS, self.frame_group, 'c4B', 'v2f')
self._highlight_disabled = batch.add(4, GL_QUADS, self.top_group, 'c4B', 'v2f')
self._highlight = batch.add(4, GL_QUADS, self.top_group, 'c4B', 'v2f')
self.selected = self.selected
self.disabled = self.disabled
GameCharacterPortrait.update_position(self)
GameCharacterPortrait.update_color(self)
示例6: update_color
def update_color(self):
Frame.update_color(self)
C = Colors.get4i
c = self.color
heavy = C(c.heavy); light = C(c.light)
self._gcp_framevlist.colors = flatten([
[255, 255, 255, 255] * 4, # equip box
[heavy] * 4, # equip box border
[light] * 4, # cardnum box
[heavy] * 4, # cardnum box border
])
示例7: update_position
def update_position(self):
Frame.update_position(self)
w, h = self.width, self.height
ax, ay = self.abs_coords()
self._gcp_framevlist.vertices[:] = flatten([
rectv2f(2, 2, w-4, 54-2, ax, ay), # equip box
rrectv2f(2.5, 2.5, 4*36, 52, ax, ay), # equip box border
rectv2f(w-2-32, 66, 32, 22, ax, ay), # cardnum box
rrectv2f(w-2-32, 66, 32, 22, ax, ay), # cardnum box border
])
full = rectv2f(0, 0, w, h, ax, ay)
self._highlight_disabled.vertices[:] = full
self._highlight.vertices[:] = full
if self.actor_frame:
self.actor_frame.set_position(self.x - 6, self.y - 4)
if self.turn_frame:
self.turn_frame.set_position(self.x - 6, self.y - 4)
示例8: __init__
def __init__(self, parent):
Frame.__init__(self, x=750, y=20, width=240, height=180, caption=u"花果子念报", parent=parent)
ta = self.textarea = TextArea(parent=self, x=2, y=10 + 2, width=240 - 4, height=180 - 24 - 2 - 10)
ta.text = u"正在获取最新新闻……"
def update(rst):
if rst:
_, content = rst
try:
ta.text = content.decode("utf-8")
return
except Exception as e:
import traceback
traceback.print_exc(e)
ta.text = u"|R无法显示新闻!|r"
from settings import HALL_NOTICE_URL
Executive.call("fetch_resource", update, HALL_NOTICE_URL)
示例9: set_color
def set_color(self, color):
Frame.set_color(self, color)
GameCharacterPortrait.update_color(self)
示例10: set_postion
def set_postion(self, x, y):
Frame.set_position(self, x, y)
GameCharacterPortrait.update_position(self)
示例11: __init__
def __init__(self, x=0.0, y=0.0, color=Colors.blue, tag_placement='me', *args, **kwargs):
self.bg = None
self.character = None
self._color = color
self._disabled = False
self._last_balloon = None
self.player = None
self._selected = False
self.taganims = []
self.tag_placement = tag_placement
Frame.__init__(
self, width=149, height=195,
bot_reserve=20, color=color,
thin_shadow=True,
**kwargs
)
self.balloon = BalloonPrompt(self, self.balloon_show)
self.view = view = self.parent
self.x, self.y = x, y
self.charname_lbl = self.add_label(
u'', 7, self.height-30,
width=16, multiline=True,
font_size=9,
anchor_x='left', anchor_y='top',
color=(255, 255, 255, 255),
shadow=(1, 0, 0, 0, 179),
)
self.portcard_area = PortraitCardArea(
parent=view,
x=self.x, y=self.y,
width=self.width, height=self.height,
zindex=100,
)
self.equipcard_area = EquipCardArea(
view=view, parent=self, x=3, y=6,
)
w, h = self.width, self.height
tbl = view.game.ui_meta.identity_table
colortbl = view.game.ui_meta.identity_color
conf = [(tbl[k], getattr(Colors, colortbl[k]), k) for k in tbl]
self.identity_btn = b = OptionButton(
conf=conf, default=0, parent=self,
x=w-42-4, y=h-24-10-18,
width=42, height=18,
)
@b.event
def on_value_changed(v):
self.set_color(b.color)
def tagarrange_bottom():
x, y = self.x, self.y
w = self.width
x += w + 1
y -= 27
for a in self.taganims: # they are pyglet.sprite.Sprite instances
x -= 27
a.set_position(x, y)
def tagarrange_me():
x, y = self.x, self.y
w = self.width
x += w + 6
y += 142
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
x += 27
def tagarrange_right():
x, y = self.x, self.y
w = self.width
x += w + 3
y += 1
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
y += 27
def tagarrange_left():
x, y = self.x, self.y
x -= 28
y += 1
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
y += 27
self._tagarrange_funcs = {
'bottom': tagarrange_bottom,
'me': tagarrange_me,
'left': tagarrange_left,
'right': tagarrange_right,
}
showncard_btn = ImageButton(
#.........这里部分代码省略.........
示例12: set_color
def set_color(self, color):
Frame.set_color(self, color)
self.inputbox.color = color
示例13: delete
def delete(self):
Frame.delete(self)
self.portcard_area.delete()
示例14: __init__
def __init__(self, x=0.0, y=0.0, color=Colors.blue, tag_placement='me', *args, **kwargs):
self.player = None
self.character = None
self._disabled = False
self._selected = False
self.taganims = []
self.tag_placement = tag_placement
self._color = color
self.bg = None
self._last_balloon = None
Frame.__init__(
self, width=149, height=195,
bot_reserve=20, color=color,
thin_shadow=True,
**kwargs
)
self.x, self.y = x, y
self.charname_lbl = self.add_label(
u'', 7, self.height-30,
width=16, multiline=True,
font_size=9,
anchor_x='left', anchor_y='top',
color=(255, 255, 255, 255),
shadow=(1, 0, 0, 0, 179),
)
from .view import THBattleUI
v = self.parent
while not isinstance(v, THBattleUI):
v = v.parent
self.view = v
self.portcard_area = PortraitCardArea(
parent=self.view,
x=self.x, y=self.y,
width=self.width, height=self.height,
zindex=100,
)
self.equipcard_area = EquipCardArea(
parent=self,
x=3, y=6,
)
w, h = self.width, self.height
self.identity_btn = b = Button(
u'?', parent=self,
x=w-42-4, y=h-24-10-18,
width=42, height=18,
)
self.cur_idtag = 0
@b.event
def on_click():
g = Game.getgame()
tbl = g.ui_meta.identity_table
colortbl = g.ui_meta.identity_color
keys = tbl.keys()
try:
i = (keys.index(self.cur_idtag) + 1) % len(keys)
except ValueError:
i = 0
next = keys[i]
b.caption = tbl[next]
color = getattr(Colors, colortbl[next])
b.color = color
self.set_color(color)
b.update()
self.update()
self.cur_idtag = next
@self.equipcard_area.event
def on_selection_change():
self.view.dispatch_event('on_selection_change')
def tagarrange_bottom():
x, y = self.x, self.y
w, h = self.width, self.height
x += w + 1
y -= 27
for a in self.taganims: # they are pyglet.sprite.Sprite instances
x -= 27
a.set_position(x, y)
def tagarrange_me():
x, y = self.x, self.y
w, h = self.width, self.height
x += w + 6
y += 142
for a in self.taganims: # they are pyglet.sprite.Sprite instances
a.set_position(x, y)
x += 27
def tagarrange_right():
x, y = self.x, self.y
w, h = self.width, self.height
x += w + 3
#.........这里部分代码省略.........