本文整理汇总了Python中theming.get_theme函数的典型用法代码示例。如果您正苦于以下问题:Python get_theme函数的具体用法?Python get_theme怎么用?Python get_theme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_theme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_groupchat_subject
def on_groupchat_subject(self, message):
"""
Triggered when the topic is changed.
"""
nick_from = message['mucnick']
room_from = message.get_mucroom()
tab = self.get_tab_by_name(room_from, tabs.MucTab)
subject = message['subject']
if subject is None or not tab:
return
if subject != tab.topic:
# Do not display the message if the subject did not change or if we
# receive an empty topic when joining the room.
if nick_from:
tab.add_message(_("\x19%(info_col)s}%(nick)s set the subject to: %(subject)s") %
{'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), 'nick':nick_from, 'subject':subject},
time=None,
typ=2)
else:
tab.add_message(_("\x19%(info_col)s}The subject is: %(subject)s") %
{'subject':subject, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)},
time=None,
typ=2)
tab.topic = subject
tab.topic_from = nick_from
if self.get_tab_by_name(room_from, tabs.MucTab) is self.current_tab():
self.refresh_window()
示例2: features_checked
def features_checked(self, iq):
"Features check callback"
features = iq['disco_info'].get_features() or []
before = ('correct' in self.commands,
self.remote_supports_attention,
self.remote_supports_receipts)
correct = self._feature_correct(features)
attention = self._feature_attention(features)
receipts = self._feature_receipts(features)
if (correct, attention, receipts) == before and self.__initial_disco:
return
else:
self.__initial_disco = True
if not (correct or attention or receipts):
return # don’t display anything
ok = get_theme().CHAR_OK
nope = get_theme().CHAR_EMPTY
correct = ok if correct else nope
attention = ok if attention else nope
receipts = ok if receipts else nope
msg = _('\x19%s}Contact supports: correction [%s], '
'attention [%s], receipts [%s].')
color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
msg = msg % (color, correct, attention, receipts)
self.add_message(msg, typ=0)
self.core.refresh_window()
示例3: write_nack
def write_nack(self):
color = get_theme().COLOR_CHAR_NACK
self._win.attron(to_curses_attr(color))
self.addstr(get_theme().CHAR_NACK)
self._win.attroff(to_curses_attr(color))
self.addstr(' ')
return poopt.wcswidth(get_theme().CHAR_NACK) + 1
示例4: write_contact_jid
def write_contact_jid(self, jid):
"""
Just write the jid that we are talking to
"""
self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self.addstr(jid.full, to_curses_attr(get_theme().COLOR_CONVERSATION_NAME))
self.addstr('] ', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
示例5: build_message
def build_message(self, message, timestamp=False):
txt = message.txt
ret = []
default_color = None
nick = truncate_nick(message.nickname)
offset = 0
if nick:
offset += poopt.wcswidth(nick) + 1 # + nick + ' ' length
if message.str_time:
offset += 1 + len(message.str_time)
if get_theme().CHAR_TIME_LEFT and message.str_time:
offset += 1
if get_theme().CHAR_TIME_RIGHT and message.str_time:
offset += 1
lines = poopt.cut_text(txt, self.width-offset-1)
prepend = default_color if default_color else ''
attrs = []
for line in lines:
saved = Line(msg=message, start_pos=line[0], end_pos=line[1], prepend=prepend)
attrs = parse_attrs(message.txt[line[0]:line[1]], attrs)
if attrs:
prepend = FORMAT_CHAR + FORMAT_CHAR.join(attrs)
else:
if default_color:
prepend = default_color
else:
prepend = ''
ret.append(saved)
return ret
示例6: refresh
def refresh(self):
self._win.erase()
y = -self.scroll_pos
i = 0
for name, field in self._form.getFields().items():
if field['type'] == 'hidden':
continue
self.inputs[i]['label'].resize(1, self.width//2, y + 1, 0)
self.inputs[i]['input'].resize(1, self.width//2, y+1, self.width//2)
# TODO: display the field description
y += 1
i += 1
self._win.refresh()
for i, inp in enumerate(self.inputs):
if i < self.scroll_pos:
continue
if i >= self.height + self.scroll_pos:
break
inp['label'].refresh()
inp['input'].refresh()
inp['label'].refresh()
if self.current_input < self.height-1:
self.inputs[self.current_input]['input'].set_color(get_theme().COLOR_SELECTED_ROW)
self.inputs[self.current_input]['input'].refresh()
self.inputs[self.current_input]['label'].set_color(get_theme().COLOR_SELECTED_ROW)
self.inputs[self.current_input]['label'].refresh()
示例7: go_to_previous_horizontal_input
def go_to_previous_horizontal_input(self):
if not self.lines:
return
if self.current_horizontal_input == 0:
return
self.lines[self.current_input][self.current_horizontal_input].set_color(get_theme().COLOR_NORMAL_TEXT)
self.current_horizontal_input -= 1
self.lines[self.current_input][self.current_horizontal_input].set_color(get_theme().COLOR_SELECTED_ROW)
示例8: go_to_next_horizontal_input
def go_to_next_horizontal_input(self):
if not self.lines:
return
self.lines[self.current_input][self.current_horizontal_input].set_color(get_theme().COLOR_NORMAL_TEXT)
self.current_horizontal_input += 1
if self.current_horizontal_input > 3:
self.current_horizontal_input = 0
self.lines[self.current_input][self.current_horizontal_input].set_color(get_theme().COLOR_SELECTED_ROW)
示例9: refresh
def refresh(self, txt=None):
log.debug('Refresh: %s', self.__class__.__name__)
if txt:
self.txt = txt
self._win.erase()
self.addstr(0, 0, self.txt[:self.width-1], to_curses_attr(get_theme().COLOR_WARNING_PROMPT))
self.finish_line(get_theme().COLOR_WARNING_PROMPT)
self._refresh()
示例10: draw_roster_information
def draw_roster_information(self, roster):
"""
The header at the top
"""
self.addstr('Roster: %s/%s contacts' % (
roster.get_nb_connected_contacts(),
len(roster)),
to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self.finish_line(get_theme().COLOR_INFORMATION_BAR)
示例11: write_contact_informations
def write_contact_informations(self, contact):
"""
Write the informations about the contact
"""
if not contact:
self.addstr("(contact not in roster)", to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
return
display_name = contact.name
if display_name:
self.addstr('%s '%(display_name), to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
示例12: draw_resource_line
def draw_resource_line(self, y, resource, colored):
"""
Draw a specific resource line
"""
color = get_theme().color_show(resource.presence)
self.addstr(y, 4, get_theme().CHAR_STATUS, to_curses_attr(color))
if colored:
self.addstr(y, 6, self.truncate_name(str(resource.jid), 6), to_curses_attr(get_theme().COLOR_SELECTED_ROW))
else:
self.addstr(y, 6, self.truncate_name(str(resource.jid), 6))
self.finish_line()
示例13: refresh
def refresh(self, name=None, window=None):
log.debug('Refresh: %s', self.__class__.__name__)
self._win.erase()
if name:
self.addstr(name, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
else:
self.addstr(self.message, to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
if window:
self.print_scroll_position(window)
self.finish_line(get_theme().COLOR_INFORMATION_BAR)
self._refresh()
示例14: draw_status_chatstate
def draw_status_chatstate(self, y, user):
show_col = get_theme().color_show(user.show)
if user.chatstate == 'composing':
char = get_theme().CHAR_CHATSTATE_COMPOSING
elif user.chatstate == 'active':
char = get_theme().CHAR_CHATSTATE_ACTIVE
elif user.chatstate == 'paused':
char = get_theme().CHAR_CHATSTATE_PAUSED
else:
char = get_theme().CHAR_STATUS
self.addstr(y, 0, char, to_curses_attr(show_col))
示例15: write_resource_information
def write_resource_information(self, resource):
"""
Write the informations about the resource
"""
if not resource:
presence = "unavailable"
else:
presence = resource.presence
color = get_theme().color_show(presence)
self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self.addstr(get_theme().CHAR_STATUS, to_curses_attr(color))
self.addstr(']', to_curses_attr(get_theme().COLOR_INFORMATION_BAR))