A bunch of more fixes.
- Update README - Remove some spurious comments here and there - Fix flake8 errors.
This commit is contained in:
parent
eedb06f0ed
commit
7a3a48a56f
@ -25,13 +25,13 @@ Following packages are *required*:
|
||||
|
||||
* 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
|
||||
|
@ -19,8 +19,6 @@
|
||||
# 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
|
||||
@ -169,7 +167,7 @@ class Buffer(QtCore.QObject):
|
||||
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)
|
||||
@ -178,7 +176,7 @@ class Buffer(QtCore.QObject):
|
||||
"""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):
|
||||
|
@ -23,10 +23,8 @@
|
||||
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']
|
||||
|
||||
|
@ -46,9 +46,7 @@ from qweechat.debug import DebugDialog
|
||||
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
|
||||
|
||||
|
||||
@ -331,7 +329,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
'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
|
||||
@ -516,10 +514,14 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
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."""
|
||||
@ -553,6 +555,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
config.write(self.config)
|
||||
QtWidgets.QMainWindow.closeEvent(self, event)
|
||||
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
app.setStyle(QtWidgets.QStyleFactory.create('Cleanlooks'))
|
||||
|
@ -34,6 +34,7 @@ import collections
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
|
||||
class WeechatDict(collections.OrderedDict):
|
||||
def __str__(self):
|
||||
return '{%s}' % ', '.join(
|
||||
@ -314,7 +315,7 @@ class Protocol:
|
||||
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[:]
|
||||
@ -343,7 +344,7 @@ def hex_and_ascii(data, bytes_per_line=10):
|
||||
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
|
||||
|
@ -24,8 +24,6 @@
|
||||
Command-line program for testing WeeChat/relay protocol.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import select
|
||||
@ -80,7 +78,8 @@ class TestProto(object):
|
||||
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')
|
||||
|
Loading…
Reference in New Issue
Block a user