本文整理汇总了Python中theming.get_theme函数的典型用法代码示例。如果您正苦于以下问题:Python get_theme函数的具体用法?Python get_theme怎么用?Python get_theme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_theme函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:Perdu,项目名称:poezio,代码行数:27,代码来源:handlers.py
示例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()
开发者ID:Perdu,项目名称:poezio,代码行数:31,代码来源:basetabs.py
示例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
开发者ID:fmeynadier,项目名称:poezio,代码行数:7,代码来源:text_win.py
示例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))
开发者ID:krackou,项目名称:poezio,代码行数:7,代码来源:info_wins.py
示例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
开发者ID:krackou,项目名称:poezio,代码行数:29,代码来源:text_win.py
示例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()
开发者ID:krackou,项目名称:poezio,代码行数:26,代码来源:data_forms.py
示例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)
开发者ID:krackou,项目名称:poezio,代码行数:8,代码来源:bookmark_forms.py
示例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)
开发者ID:krackou,项目名称:poezio,代码行数:8,代码来源:bookmark_forms.py
示例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()
开发者ID:fmeynadier,项目名称:poezio,代码行数:8,代码来源:input_placeholders.py
示例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)
开发者ID:fmeynadier,项目名称:poezio,代码行数:9,代码来源:roster_win.py
示例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))
开发者ID:krackou,项目名称:poezio,代码行数:10,代码来源:info_wins.py
示例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()
开发者ID:fmeynadier,项目名称:poezio,代码行数:11,代码来源:roster_win.py
示例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()
开发者ID:krackou,项目名称:poezio,代码行数:11,代码来源:info_wins.py
示例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))
开发者ID:Perdu,项目名称:poezio,代码行数:11,代码来源:muc.py
示例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))
开发者ID:krackou,项目名称:poezio,代码行数:12,代码来源:info_wins.py
示例16: command_smp
def command_smp(self, args):
"""
/otrsmp <ask|answer|abort> [question] [secret]
"""
if args is None or not args:
return self.core.command_help('otrsmp')
length = len(args)
action = args.pop(0)
if length == 2:
question = None
secret = args.pop(0).encode('utf-8')
elif length == 3:
question = args.pop(0).encode('utf-8')
secret = args.pop(0).encode('utf-8')
else:
question = secret = None
tab = self.api.current_tab()
name = tab.name
if isinstance(tab, DynamicConversationTab) and tab.locked_resource:
name = safeJID(tab.name)
name.resource = tab.locked_resource
name = name.full
format_dict = {
'jid_c': '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID),
'info': '\x19%s}' % dump_tuple(get_theme().COLOR_INFORMATION_TEXT),
'jid': name,
'bare_jid': safeJID(name).bare
}
ctx = self.get_context(name)
if ctx.state != STATE_ENCRYPTED:
self.api.information('The current conversation is not encrypted',
'Error')
return
if action == 'ask':
ctx.in_smp = True
ctx.smp_own = True
if question:
ctx.smpInit(secret, question)
else:
ctx.smpInit(secret)
tab.add_message(SMP_INITIATED % format_dict, typ=0)
elif action == 'answer':
ctx.smpGotSecret(secret)
elif action == 'abort':
if ctx.in_smp:
ctx.smpAbort()
tab.add_message(SMP_ABORTED % format_dict, typ=0)
self.core.refresh_window()
开发者ID:manasb,项目名称:poezio,代码行数:52,代码来源:otr.py
示例17: go_to_previous_line_input
def go_to_previous_line_input(self):
if not self.lines:
return
if self.current_input == 0:
return
self.lines[self.current_input][self.current_horizontal_input].set_color(get_theme().COLOR_NORMAL_TEXT)
self.current_input -= 1
# Adjust the scroll position if the current_input would be outside
# of the visible area
if self.current_input < self.scroll_pos:
self.scroll_pos = self.current_input
self.refresh()
self.lines[self.current_input][self.current_horizontal_input].set_color(get_theme().COLOR_SELECTED_ROW)
开发者ID:krackou,项目名称:poezio,代码行数:13,代码来源:bookmark_forms.py
示例18: refresh
def refresh(self, topic=None):
log.debug('Refresh: %s', self.__class__.__name__)
self._win.erase()
if topic:
msg = topic[:self.width-1]
else:
msg = self._message[:self.width-1]
self.addstr(0, 0, msg, to_curses_attr(get_theme().COLOR_TOPIC_BAR))
(y, x) = self._win.getyx()
remaining_size = self.width - x
if remaining_size:
self.addnstr(' '*remaining_size, remaining_size,
to_curses_attr(get_theme().COLOR_INFORMATION_BAR))
self._refresh()
开发者ID:Perdu,项目名称:poezio,代码行数:14,代码来源:muc.py
示例19: on_conversation_say
def on_conversation_say(self, msg, tab):
"""
On message sent
"""
if isinstance(tab, DynamicConversationTab) and tab.locked_resource:
jid = safeJID(tab.name)
jid.resource = tab.locked_resource
name = jid.full
else:
name = tab.name
jid = safeJID(tab.name)
format_dict = {
'jid_c': '\x19%s}' % dump_tuple(get_theme().COLOR_MUC_JID),
'info': '\x19%s}' % dump_tuple(get_theme().COLOR_INFORMATION_TEXT),
'jid': name,
}
ctx = None
default_ctx = self.get_context(name)
if isinstance(tab, DynamicConversationTab) and not tab.locked_resource:
log.debug('Unlocked tab %s found, falling back to the first encrypted chat we find.', name)
ctx = self.find_encrypted_context_with_matching(jid.bare)
if ctx is None:
ctx = default_ctx
if ctx and ctx.state == STATE_ENCRYPTED:
ctx.sendMessage(0, msg['body'].encode('utf-8'))
if not tab.send_chat_state('active'):
tab.send_chat_state('inactive', always_send=True)
tab.add_message(msg['body'],
nickname=self.core.own_nick or tab.own_nick,
nick_color=get_theme().COLOR_OWN_NICK,
identifier=msg['id'],
jid=self.core.xmpp.boundjid,
typ=ctx.log)
# remove everything from the message so that it doesn’t get sent
del msg['body']
del msg['replace']
del msg['html']
elif ctx and ctx.getPolicy('REQUIRE_ENCRYPTION'):
tab.add_message(MESSAGE_NOT_SENT % format_dict, typ=0)
del msg['body']
del msg['replace']
del msg['html']
self.otr_start(tab, name, format_dict)
开发者ID:fmeynadier,项目名称:poezio,代码行数:49,代码来源:otr.py
示例20: draw_group
def draw_group(self, y, group, colored):
"""
Draw a groupname on a line
"""
if colored:
self._win.attron(to_curses_attr(get_theme().COLOR_SELECTED_ROW))
if group.folded:
self.addstr(y, 0, '[+] ')
else:
self.addstr(y, 0, '[-] ')
contacts = " (%s/%s)" % (group.get_nb_connected_contacts(), len(group))
self.addstr(y, 4, self.truncate_name(group.name, len(contacts)+4) + contacts)
if colored:
self._win.attroff(to_curses_attr(get_theme().COLOR_SELECTED_ROW))
self.finish_line()
开发者ID:fmeynadier,项目名称:poezio,代码行数:15,代码来源:roster_win.py
注:本文中的theming.get_theme函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论