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


Python Network.disconnect_weechat方法代码示例

本文整理汇总了Python中network.Network.disconnect_weechat方法的典型用法代码示例。如果您正苦于以下问题:Python Network.disconnect_weechat方法的具体用法?Python Network.disconnect_weechat怎么用?Python Network.disconnect_weechat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在network.Network的用法示例。


在下文中一共展示了Network.disconnect_weechat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindow

# 需要导入模块: from network import Network [as 别名]
# 或者: from network.Network import disconnect_weechat [as 别名]
class MainWindow(QtGui.QMainWindow):
    """Main window."""

    def __init__(self, *args):
        QtGui.QMainWindow.__init__(*(self,) + args)
        app = QtGui.QApplication.instance()
        self.config = config.read()
        app.config = self.config

        self.resize(1000, 600)
        self.setWindowTitle(NAME)

        self.debug_dialog = None
        self.debug_lines = []

        self.about_dialog = None
        self.connection_dialog = None
        self.preferences_dialog = None

        # network
        self.network = Network()
        self.network.statusChanged.connect(self._network_status_changed)
        self.network.messageFromWeechat.connect(self._network_weechat_msg)
        self._last_msgid = None

        # list of buffers
        self.switch_buffers = BufferSwitchWidget()
        self.switch_buffers.currentItemChanged.connect(self._buffer_switch)
        self._hotlist = []

        # default buffer
        self.buffers = [Buffer()]
        self.stacked_buffers = QtGui.QStackedWidget()
        self.stacked_buffers.addWidget(self.buffers[0].widget)

        # splitter with buffers + chat/input
        self.splitter = QtGui.QSplitter()
        self.splitter.addWidget(self.switch_buffers)
        self.splitter.addWidget(self.stacked_buffers)

        self.setCentralWidget(self.splitter)

        # notification manager:
        self.notifier = NotificationManager(self)

        # actions for menu and toolbar
        actions_def = {
            'connect': [
                'network-connect', 'Connect to WeeChat',
                'Ctrl+O', self.open_connection_dialog],
            'disconnect': [
                'network-disconnect', 'Disconnect from WeeChat',
                'Ctrl+D', self.network.disconnect_weechat],
            'debug': [
                'edit-find', 'Debug console window',
                'Ctrl+Shift+B', self.open_debug_dialog],
            'view source': [
                None, 'View buffer chat source',
                'Ctrl+Shift+U', self.open_chat_source],
            '_reconnect': [
                None, 'Test Reconnect',
                None, self.network._reconnect_weechat],
            'preferences': [
                'preferences-other', 'Preferences',
                'Ctrl+P', self.open_preferences_dialog],
            'about': [
                'help-about', 'About',
                'Ctrl+H', self.open_about_dialog],
            'save connection': [
                'document-save', 'Save connection configuration',
                'Ctrl+S', self.save_connection],
            'quit': [
                'application-exit', 'Quit application',
                'Ctrl+Q', self.close],
        }
        # toggleable actions
        self.toggles_def = {
            'show menubar': [
                False, 'Show Menubar', 'Ctrl+M',
                lambda: self.config_toggle('look', 'menubar'),
                'look.menubar'],
            'show toolbar': [
                False, 'Show Toolbar',
                False, lambda: self.config_toggle('look', 'toolbar'),
                'look.toolbar'],
            'show status bar': [
                False, 'Show Status Bar',
                False, lambda: self.config_toggle('look', 'statusbar'),
                'look.statusbar'],
            'show title': [
                False, 'Show Topic',
                False, lambda: self.config_toggle('look', 'title'),
                'look.title'],
            'show nick list': [
                False, 'Show Nick List',
                'Ctrl+F7', lambda: self.config_toggle('look', 'nicklist'),
                'look.nicklist'],
            'fullscreen': [
                False, 'Fullscreen',
                'F11', self.toggle_fullscreen],
#.........这里部分代码省略.........
开发者ID:rickybrent,项目名称:qweechat,代码行数:103,代码来源:qweechat.py

示例2: MainWindow

# 需要导入模块: from network import Network [as 别名]
# 或者: from network.Network import disconnect_weechat [as 别名]
class MainWindow(QtGui.QMainWindow):
    """Main window."""

    def __init__(self, *args):
        QtGui.QMainWindow.__init__(*(self,) + args)

        self.config = config.read()

        self.resize(1000, 600)
        self.setWindowTitle(NAME)

        self.debug_dialog = None
        self.debug_lines = []

        self.about_dialog = None
        self.connection_dialog = None
        self.preferences_dialog = None

        # network
        self.network = Network()
        self.network.statusChanged.connect(self._network_status_changed)
        self.network.messageFromWeechat.connect(self._network_weechat_msg)

        # list of buffers
        self.list_buffers = BufferListWidget()
        self.list_buffers.currentRowChanged.connect(self._buffer_switch)

        # default buffer
        self.buffers = [Buffer()]
        self.stacked_buffers = QtGui.QStackedWidget()
        self.stacked_buffers.addWidget(self.buffers[0].widget)

        # splitter with buffers + chat/input
        splitter = QtGui.QSplitter()
        splitter.addWidget(self.list_buffers)
        splitter.addWidget(self.stacked_buffers)

        self.setCentralWidget(splitter)

        if self.config.getboolean('look', 'statusbar'):
            self.statusBar().visible = True

        # actions for menu and toolbar
        actions_def = {
            'connect': [
                'network-connect.png', 'Connect to WeeChat',
                'Ctrl+O', self.open_connection_dialog],
            'disconnect': [
                'network-disconnect.png', 'Disconnect from WeeChat',
                'Ctrl+D', self.network.disconnect_weechat],
            'debug': [
                'edit-find.png', 'Debug console window',
                'Ctrl+B', self.open_debug_dialog],
            'preferences': [
                'preferences-other.png', 'Preferences',
                'Ctrl+P', self.open_preferences_dialog],
            'about': [
                'help-about.png', 'About',
                'Ctrl+H', self.open_about_dialog],
            'save connection': [
                'document-save.png', 'Save connection configuration',
                'Ctrl+S', self.save_connection],
            'quit': [
                'application-exit.png', 'Quit application',
                'Ctrl+Q', self.close],
        }
        self.actions = {}
        for name, action in list(actions_def.items()):
            self.actions[name] = QtGui.QAction(
                QtGui.QIcon(
                    resource_filename(__name__, 'data/icons/%s' % action[0])),
                name.capitalize(), self)
            self.actions[name].setStatusTip(action[1])
            self.actions[name].setShortcut(action[2])
            self.actions[name].triggered.connect(action[3])

        # menu
        self.menu = self.menuBar()
        menu_file = self.menu.addMenu('&File')
        menu_file.addActions([self.actions['connect'],
                              self.actions['disconnect'],
                              self.actions['preferences'],
                              self.actions['save connection'],
                              self.actions['quit']])
        menu_window = self.menu.addMenu('&Window')
        menu_window.addAction(self.actions['debug'])
        menu_help = self.menu.addMenu('&Help')
        menu_help.addAction(self.actions['about'])
        self.network_status = QtGui.QLabel()
        self.network_status.setFixedHeight(20)
        self.network_status.setFixedWidth(200)
        self.network_status.setContentsMargins(0, 0, 10, 0)
        self.network_status.setAlignment(QtCore.Qt.AlignRight)
        if hasattr(self.menu, 'setCornerWidget'):
            self.menu.setCornerWidget(self.network_status,
                                      QtCore.Qt.TopRightCorner)
        self.network_status_set(self.network.status_disconnected)

        # toolbar
        toolbar = self.addToolBar('toolBar')
#.........这里部分代码省略.........
开发者ID:caustin,项目名称:qweechat,代码行数:103,代码来源:qweechat.py


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