Add some missing docstrings
This commit is contained in:
parent
8b36cd49b1
commit
ac53e98cd0
@ -128,5 +128,6 @@ def write(config):
|
|||||||
|
|
||||||
|
|
||||||
def color_options():
|
def color_options():
|
||||||
|
"""Return color options."""
|
||||||
global config_color_options
|
global config_color_options
|
||||||
return config_color_options
|
return config_color_options
|
||||||
|
@ -111,12 +111,15 @@ class Network(QtCore.QObject):
|
|||||||
self.statusChanged.emit(self.status_disconnected, None)
|
self.statusChanged.emit(self.status_disconnected, None)
|
||||||
|
|
||||||
def is_connected(self):
|
def is_connected(self):
|
||||||
|
"""Return True if the socket is connected, False otherwise."""
|
||||||
return self._socket.state() == QtNetwork.QAbstractSocket.ConnectedState
|
return self._socket.state() == QtNetwork.QAbstractSocket.ConnectedState
|
||||||
|
|
||||||
def is_ssl(self):
|
def is_ssl(self):
|
||||||
|
"""Return True if SSL is used, False otherwise."""
|
||||||
return self._ssl
|
return self._ssl
|
||||||
|
|
||||||
def connect_weechat(self, server, port, ssl, password, lines):
|
def connect_weechat(self, server, port, ssl, password, lines):
|
||||||
|
"""Connect to WeeChat."""
|
||||||
self._server = server
|
self._server = server
|
||||||
try:
|
try:
|
||||||
self._port = int(port)
|
self._port = int(port)
|
||||||
@ -139,6 +142,7 @@ class Network(QtCore.QObject):
|
|||||||
self.statusChanged.emit(self.status_connecting, None)
|
self.statusChanged.emit(self.status_connecting, None)
|
||||||
|
|
||||||
def disconnect_weechat(self):
|
def disconnect_weechat(self):
|
||||||
|
"""Disconnect from WeeChat."""
|
||||||
if self._socket.state() == QtNetwork.QAbstractSocket.UnconnectedState:
|
if self._socket.state() == QtNetwork.QAbstractSocket.UnconnectedState:
|
||||||
return
|
return
|
||||||
if self._socket.state() == QtNetwork.QAbstractSocket.ConnectedState:
|
if self._socket.state() == QtNetwork.QAbstractSocket.ConnectedState:
|
||||||
@ -149,12 +153,15 @@ class Network(QtCore.QObject):
|
|||||||
self._socket.abort()
|
self._socket.abort()
|
||||||
|
|
||||||
def send_to_weechat(self, message):
|
def send_to_weechat(self, message):
|
||||||
|
"""Send a message to WeeChat."""
|
||||||
self._socket.write(message.encode('utf-8'))
|
self._socket.write(message.encode('utf-8'))
|
||||||
|
|
||||||
def desync_weechat(self):
|
def desync_weechat(self):
|
||||||
|
"""Desynchronize from WeeChat."""
|
||||||
self.send_to_weechat('desync\n')
|
self.send_to_weechat('desync\n')
|
||||||
|
|
||||||
def sync_weechat(self):
|
def sync_weechat(self):
|
||||||
|
"""Synchronize with WeeChat."""
|
||||||
self.send_to_weechat('\n'.join(_PROTO_SYNC_CMDS))
|
self.send_to_weechat('\n'.join(_PROTO_SYNC_CMDS))
|
||||||
|
|
||||||
def status_icon(self, status):
|
def status_icon(self, status):
|
||||||
|
Loading…
Reference in New Issue
Block a user