当前位置: 首页>>代码示例>>Python>>正文


Python Network.get_options方法代码示例

本文整理汇总了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')
开发者ID:rickybrent,项目名称:qweechat,代码行数:69,代码来源:qweechat.py

示例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')
开发者ID:caustin,项目名称:qweechat,代码行数:69,代码来源:qweechat.py


注:本文中的network.Network.get_options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。