From ec9e07f7e73829ff43112c224daef191525573a9 Mon Sep 17 00:00:00 2001 From: karxi Date: Tue, 13 Dec 2016 13:08:36 -0500 Subject: [PATCH] Minor changes for when the console is done --- TODO.mkdn | 9 ++++++++- pesterchum.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/TODO.mkdn b/TODO.mkdn index 0c7a9c5..bfc09be 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -43,9 +43,13 @@ Features * Implement MemoServ support * Add support for displaying more verbose information (e.g. Cease messages which tell you more than the abbreviation of who left) * Make Pesterchum recognize conventional /mes so they aren't invisible -* Fix NickServ auto-login things * Tell user when NickServ handles are going to expire * Tell user when old handles have D/C'd? Offer autoghost support?! +* Make @XY and @xxxYyy formats ping their targets +* Allow matches like @?XY and @FXY or @PXY3 - make them only match the target currently set to that. +* Make @ notation not match @u@; and similar (make invalid nick chars break matches) +* Fix hyperlink escaping (Qt seems to do this automatically - need a workaround) +* Show bans if +h or higher (+h, +o, +a, +q) * Add more comprehensive status support - IDLE, DND, INVISIBLE for now - or at least add similar functionality. * SEPARATE FUNCTIONALITY from CONNECTED STATE!! This is a huge problem! Being shunted off our nick closes windows and breaks things! Just D/C and reconnect? @@ -62,9 +66,11 @@ Features * Right-click Time entry field to see those used? (Replace left/right buttons?) * Make the memo name entry box accept a comma-separated list * Make right-clicking on a tab open up the right-click menu one would get on right-clicking the title (frame??) +* Add an option to Cycle (for log separation) * Add a separate 'Tweaks' section in Options * Fix graphical issues with dark themes vs. light themes (Qt/text too light/etc.) +* Allow manual compression changes via memo right-click menu for 'advanced' (per the setting) users Todo/Done ---- @@ -76,6 +82,7 @@ Todo/Done * Color tags are now posted as their shorter hexadecimal forms, if applicable (255,255,255 -> #FFFFFF, for example) * Separate auto-idle and checkbox idle so they don't share a state (and make the first send set the timer for additional idle responses) * Stop us from sending IDLE messages to NickServ +* Fix NickServ auto-login things Debugging ---- diff --git a/pesterchum.py b/pesterchum.py index a7fd695..88fc5a7 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -12,9 +12,20 @@ from time import time import threading, Queue from pnc.dep.attrdict import AttrDict -import logging logging.basicConfig(level=logging.WARNING) +try: + import console +except ImportError: + _CONSOLE = False + logging.warning("Console file not shipped; skipping.") +except Exception as err: + _CONSOLE = False + # Consider erroring? + logging.error("Failed to load console!", exc_info=err) +else: + _CONSOLE = True + reqmissing = [] optmissing = [] try: @@ -996,6 +1007,11 @@ class PesterWindow(MovingWindow): MovingWindow.__init__(self, parent, (QtCore.Qt.CustomizeWindowHint | QtCore.Qt.FramelessWindowHint)) + + # For debugging + global PESTERAPP + PESTERAPP = app + self.autoJoinDone = False self.app = app self.convos = CaseInsensitiveDict() @@ -1091,6 +1107,13 @@ class PesterWindow(MovingWindow): self.menu = QtGui.QMenuBar(self) self.menu.setNativeMenuBar(False) + self.console = AttrDict() + self.console.window = None + self.console.action = QtGui.QAction("Console", self) + self.connect(self.console.action, QtCore.SIGNAL('triggered()'), + self, QtCore.SLOT('showConsole()')) + self.console.is_open = False + filemenu = self.menu.addMenu(self.theme["main/menus/client/_name"]) self.filemenu = filemenu filemenu.addAction(opts) @@ -1103,6 +1126,8 @@ class PesterWindow(MovingWindow): filemenu.addAction(talk) filemenu.addAction(self.idleaction) filemenu.addAction(grps) + if _CONSOLE: + filemenu.addAction(self.console.action) filemenu.addAction(self.importaction) filemenu.addAction(self.reconnectAction) filemenu.addAction(exitaction) @@ -1464,6 +1489,34 @@ class PesterWindow(MovingWindow): self.connect(self.tabmemo, QtCore.SIGNAL('windowClosed()'), self, QtCore.SLOT('memoTabsClosed()')) + @QtCore.pyqtSlot() + def showConsole(self): + if not _CONSOLE: + # We don't have the module file for this at the moment. + return + win = self.console.window + if win is None: + # We have no console window; make one. + logging.warning("Making a console....") + self.console.window = win = console.ConsoleWindow(parent=self) + logging.warning("Console made.") + self.connect(win, QtCore.SIGNAL('windowClosed()'), + self, QtCore.SLOT('consoleWindowClosed()')) + if self.console.is_open: + # Already open - hide the console. + win.hide() + self.console.is_open = False + else: + # Console isn't visible - show it. + win.show() + self.console.is_open = True + + @QtCore.pyqtSlot() + def consoleWindowClosed(self): + self.console.is_open = False + self.console.window = None + logging.warning("Console closed.") + def newMemo(self, channel, timestr, secret=False, invite=False): if channel == "#pesterchum": return