* WeeChat (version >= 0.3.7) on local or remote machine, with relay plugin
enabled and listening on a port with protocol "weechat"
-* Python 2.x >= 2.6
-* PySide (recommended, packages: python.pyside.*) or PyQt4 (python-qt4)
+* Python 3.7+
+* PySide6
=== Install via source distribution
----
-$ python setup.py install
+$ pip install .
----
== WeeChat setup
# You should have received a copy of the GNU General Public License
# along with QWeeChat. If not, see <http://www.gnu.org/licenses/>.
#
-import traceback
-
from pkg_resources import resource_filename
from qweechat.chat import ChatTextEdit
from qweechat.input import InputLineEdit
try:
self.widget.set_title(
color.remove(self.data['title']))
- except Exception as e: # noqa: E722
+ except Exception: # noqa: E722
# TODO: Debug print the exception to be fixed.
# traceback.print_exc()
self.widget.set_title(None)
"""Update prompt."""
try:
self.widget.set_prompt(self.data['local_variables']['nick'])
- except Exception as e: # noqa: E722
+ except Exception: # noqa: E722
self.widget.set_prompt(None)
def input_text_sent(self, text):
import struct
from qweechat import config
from PySide6 import QtCore, QtNetwork
-from PySide6.QtCore import QObject, Signal
+from PySide6.QtCore import Signal
-# QtCore = qt_compat.import_module('QtCore')
-# QtNetwork = qt_compat.import_module('QtNetwork')
_PROTO_INIT_CMD = ['init password=%(password)s']
from qweechat.about import AboutDialog
from qweechat.version import qweechat_version
-from PySide6.QtWidgets import (
- QApplication, QLabel, QPushButton, QVBoxLayout, QWidget)
-from PySide6.QtCore import Qt, Slot
+from PySide6.QtWidgets import QApplication
from PySide6 import QtGui, QtWidgets, QtCore
'message uncompressed (%d bytes):\n%s'
% (message.size_uncompressed,
protocol.hex_and_ascii(message.uncompressed, 20)),
- forcecolor='#008800')
+ forcecolor='#008800')
self.debug_display(0, '', 'Message: %s' % message)
self.parse_message(message)
except Exception: # noqa: E722
def insert_buffer(self, index, buf):
"""Insert a buffer in list."""
self.buffers.insert(index, buf)
- self.list_buffers.insertItem(index, '%d. %s'
- % (buf.data['number'],
- buf.data['full_name']))
+ self.list_buffers.insertItem(index, '%s'
+ % (buf.data['local_variables']['name']))
self.stacked_buffers.insertWidget(index, buf.widget)
+ self._reorder_buffers()
+
+ def _reorder_buffers(self):
+ """Order buffers by server."""
+ pass
def remove_buffer(self, index):
"""Remove a buffer."""
config.write(self.config)
QtWidgets.QMainWindow.closeEvent(self, event)
+
def main():
app = QApplication(sys.argv)
app.setStyle(QtWidgets.QStyleFactory.create('Cleanlooks'))
import struct
import zlib
+
class WeechatDict(collections.OrderedDict):
def __str__(self):
return '{%s}' % ', '.join(
uncompressed = zlib.decompress(self.data[5:])
size_uncompressed = len(uncompressed) + 5
uncompressed = b'%s%s%s' % (struct.pack('>i', size_uncompressed),
- struct.pack('b', 0), uncompressed)
+ struct.pack('b', 0), uncompressed)
self.data = uncompressed
else:
uncompressed = self.data[:]
for i in range(num_lines):
str_hex = []
str_ascii = []
- for j in range(bytes_per_line): # data[i*bytes_per_line:(i*bytes_per_line)+bytes_per_line]:
+ for j in range(bytes_per_line):
# We can't easily iterate over individual bytes, so we are going to
# do it this way.
index = (i*bytes_per_line) + j
Command-line program for testing WeeChat/relay protocol.
"""
-
-
import argparse
import os
import select
if msg == b'quit':
self.has_quit = True
self.sock.sendall(msg + b'\n')
- sys.stdout.write((b'\x1b[33m<-- ' + msg + b'\x1b[0m\n').decode())
+ sys.stdout.write(
+ (b'\x1b[33m<-- ' + msg + b'\x1b[0m\n').decode())
except: # noqa: E722
traceback.print_exc()
print('Failed to send message')