本文整理汇总了Python中network.Network.get_options方法的典型用法代码示例。如果您正苦于以下问题:Python Network.get_options方法的具体用法?Python Network.get_options怎么用?Python Network.get_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network.Network
的用法示例。
在下文中一共展示了Network.get_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from network import Network [as 别名]
# 或者: from network.Network import get_options [as 别名]
#.........这里部分代码省略.........
def buffer_hotlist_clear(self, full_name):
"""Set a buffer as read for the hotlist."""
buf = self.buffers[self._buffer_index("full_name", full_name)[0]]
self.notifier.clear_record(full_name)
if buf.pointer in self._hotlist:
buf.highlight = False
buf.hot = 0
self._hotlist.remove(buf.pointer)
self.switch_buffers.update_hot_buffers()
if self.network.server_version >= 1:
self.buffer_input(full_name, '/buffer set hotlist -1')
self.buffer_input(full_name, '/input set_unread_current_buffer')
else:
self.buffer_input('core.weechat', '/buffer ' + full_name)
def buffer_input(self, full_name, text):
"""Send buffer input to WeeChat."""
if self.network.is_connected():
if text[:6] == "/query":
nick = full_name.rsplit(".", 1)[0] + "." + text.split(" ")[-1]
self.requested_buffer_names.add(nick)
message = 'input %s %s\n' % (full_name, text)
self.network.send_to_weechat(message)
self.debug_display(0, '<==', message, forcecolor='#AA0000')
def open_preferences_dialog(self):
"""Open a dialog with preferences."""
self.preferences_dialog = PreferencesDialog('Preferences', self)
def save_connection(self):
"""Save connection configuration."""
if self.network:
options = self.network.get_options()
for option in options.keys():
self.config.set('relay', option, options[option])
def debug_display(self, *args, **kwargs):
"""Display a debug message."""
self.debug_lines.append((args, kwargs))
self.debug_lines = self.debug_lines[-DEBUG_NUM_LINES:]
if self.debug_dialog:
self.debug_dialog.chat.display(*args, **kwargs)
def open_debug_dialog(self):
"""Open a dialog with debug messages."""
if not self.debug_dialog:
self.debug_dialog = DebugDialog(self)
self.debug_dialog.input.textSent.connect(
self.debug_input_text_sent)
self.debug_dialog.finished.connect(self._debug_dialog_closed)
self.debug_dialog.display_lines(self.debug_lines)
self.debug_dialog.chat.scroll_bottom()
def debug_input_text_sent(self, text):
"""Send debug buffer input to WeeChat."""
if self.network.is_connected():
text = str(text)
pos = text.find(')')
if text.startswith('(') and pos >= 0:
text = '(debug_%s)%s' % (text[1:pos], text[pos+1:])
else:
text = '(debug) %s' % text
self.debug_display(0, '<==', text, forcecolor='#AA0000')
self.network.send_to_weechat(text + '\n')
示例2: MainWindow
# 需要导入模块: from network import Network [as 别名]
# 或者: from network.Network import get_options [as 别名]
#.........这里部分代码省略.........
if self.config.getboolean('relay', 'autoconnect'):
self.network.connect_weechat(self.config.get('relay', 'server'),
self.config.get('relay', 'port'),
self.config.getboolean('relay',
'ssl'),
self.config.get('relay', 'password'),
self.config.get('relay', 'lines'))
self.show()
def _buffer_switch(self, index):
"""Switch to a buffer."""
if index >= 0:
self.stacked_buffers.setCurrentIndex(index)
self.stacked_buffers.widget(index).input.setFocus()
def buffer_input(self, full_name, text):
"""Send buffer input to WeeChat."""
if self.network.is_connected():
message = 'input %s %s\n' % (full_name, text)
self.network.send_to_weechat(message)
self.debug_display(0, '<==', message, forcecolor='#AA0000')
def open_preferences_dialog(self):
"""Open a dialog with preferences."""
# TODO: implement the preferences dialog box
messages = ['Not yet implemented!',
'']
self.preferences_dialog = AboutDialog('Preferences', messages, self)
def save_connection(self):
"""Save connection configuration."""
if self.network:
options = self.network.get_options()
for option in options.keys():
self.config.set('relay', option, options[option])
def debug_display(self, *args, **kwargs):
"""Display a debug message."""
self.debug_lines.append((args, kwargs))
self.debug_lines = self.debug_lines[-DEBUG_NUM_LINES:]
if self.debug_dialog:
self.debug_dialog.chat.display(*args, **kwargs)
def open_debug_dialog(self):
"""Open a dialog with debug messages."""
if not self.debug_dialog:
self.debug_dialog = DebugDialog(self)
self.debug_dialog.input.textSent.connect(
self.debug_input_text_sent)
self.debug_dialog.finished.connect(self._debug_dialog_closed)
self.debug_dialog.display_lines(self.debug_lines)
self.debug_dialog.chat.scroll_bottom()
def debug_input_text_sent(self, text):
"""Send debug buffer input to WeeChat."""
if self.network.is_connected():
text = str(text)
pos = text.find(')')
if text.startswith('(') and pos >= 0:
text = '(debug_%s)%s' % (text[1:pos], text[pos+1:])
else:
text = '(debug) %s' % text
self.debug_display(0, '<==', text, forcecolor='#AA0000')
self.network.send_to_weechat(text + '\n')