]> jfr.im git - irc/weechat/qweechat.git/commitdiff
A bunch of more fixes.
authorAbhilash Raj <redacted>
Tue, 1 Jun 2021 05:43:37 +0000 (22:43 -0700)
committerAbhilash Raj <redacted>
Tue, 1 Jun 2021 05:45:14 +0000 (22:45 -0700)
- Update README
- Remove some spurious comments here and there
- Fix flake8 errors.

README.adoc
qweechat/buffer.py
qweechat/network.py
qweechat/qweechat.py
qweechat/weechat/protocol.py
qweechat/weechat/testproto.py

index c3378b005ce52cb29ebc585ed7216eba72bd1ca7..074dc3d0813b38267e36e21a8bac41dc530f17c3 100644 (file)
@@ -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
index 88e403ea896d315ecc0349f40647c7fdde4ec66d..c501d4830e82758a06e74ede69f74ce34b222c92 100644 (file)
@@ -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):
index 52e190c469dd087d13008abf0211ecb76730f2df..fe64d0f6a0b64e4aeca0aa670b6847f6bef73095 100644 (file)
 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']
 
index 0b382265a740668e17ab9d37e2a03872c031dabe..76db5a45a1461e6ba3efbd16eb5f5155d6f6f7f8 100644 (file)
@@ -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'))
index 6283b2b0a743d31a22f6fd3fc6e644e08faefbcc..4a69378ee73b0e60a666241bb6eb0469fe70f99b 100644 (file)
@@ -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
index 06a0b539e3809d3ddd95ab1d6ba25d3952214763..54cd2c8226e56dc09af52a76f42a08f4c6246431 100644 (file)
@@ -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')