PyQt5 --> PyQt6 💚

This commit is contained in:
Dpeta 2022-06-27 04:18:37 +02:00
parent 0eeebe349d
commit 2576be41aa
22 changed files with 940 additions and 934 deletions

View file

@ -1,6 +1,11 @@
# Changelog # Changelog
(This document uses YYYY-MM-DD) (This document uses YYYY-MM-DD)
## [v2.4] - 2022-06-27
### Changed
- Transitioned from PyQt5 to PyQt6 🌈
## [v2.3.1] - 2022-06-23 ## [v2.3.1] - 2022-06-23
### Added ### Added

View file

@ -7,8 +7,8 @@ This repository builds on (and was mirrored from!) pesterchum-karxi + Hydrotherm
Check out [CHANGELOG.md] file to see what's changed! Check out [CHANGELOG.md] file to see what's changed!
[CHANGELOG.md]: https://github.com/Dpeta/pesterchum-alt-servers/blob/py3_pyqt5/CHANGELOG.md [CHANGELOG.md]: https://github.com/Dpeta/pesterchum-alt-servers/blob/main/CHANGELOG.md
[TODO.md]: https://github.com/Dpeta/pesterchum-alt-servers/blob/py3_pyqt5/TODO.md [TODO.md]: https://github.com/Dpeta/pesterchum-alt-servers/blob/main/TODO.md
## GUIDES ## GUIDES
@ -20,9 +20,9 @@ I'd highly recommend you take a look at the following files if you're new to Pes
Guides for python quirks and themes are also in the [docs] folder. If you want to set up a gradient quirk you should take a look at [these guides][gradient-guide]. Guides for python quirks and themes are also in the [docs] folder. If you want to set up a gradient quirk you should take a look at [these guides][gradient-guide].
[gradient-guide]: https://paste.0xfc.de/?e60df5a155e93583#AmcgN9cRnCcBycmVMvw6KJ1YLKPXGbaSzZLbgAhoNCQD [gradient-guide]: https://paste.0xfc.de/?e60df5a155e93583#AmcgN9cRnCcBycmVMvw6KJ1YLKPXGbaSzZLbgAhoNCQD
[trollquirks.mkdn]: https://github.com/Dpeta/pesterchum-alt-servers/blob/py3_pyqt5/docs/trollquirks.mkdn [trollquirks.mkdn]: https://github.com/Dpeta/pesterchum-alt-servers/blob/main/docs/trollquirks.mkdn
[README-pesterchum.mkdn]: https://github.com/Dpeta/pesterchum-alt-servers/blob/py3_pyqt5/docs/README-pesterchum.mkdn [README-pesterchum.mkdn]: https://github.com/Dpeta/pesterchum-alt-servers/blob/main/docs/README-pesterchum.mkdn
[docs]: https://github.com/Dpeta/pesterchum-alt-servers/tree/py3_pyqt5/docs/ [docs]: https://github.com/Dpeta/pesterchum-alt-servers/tree/main/docs/
## INSTALLATION ## INSTALLATION
1. Download the appropriate release for your platform and architecture from [releases][releases]. 1. Download the appropriate release for your platform and architecture from [releases][releases].
@ -50,7 +50,7 @@ Pesterchum is a Python script. This means that as long as you have Python instal
### REQUIREMENTS ### REQUIREMENTS
- [Python 3] - [Python 3]
- [PyQt5>=5.15] - [PyQt6]
- [pygame] (Only required for audio, Pesterchum will probably still run without it.) - [pygame] (Only required for audio, Pesterchum will probably still run without it.)
### WALKTHROUGH ### WALKTHROUGH
@ -60,17 +60,17 @@ Pesterchum is a Python script. This means that as long as you have Python instal
- Some platforms, mostly Linux and macOS, might require you to run ``python3`` instead of ``python``. Some old installations still have Python 2 available under ``python``. - Some platforms, mostly Linux and macOS, might require you to run ``python3`` instead of ``python``. Some old installations still have Python 2 available under ``python``.
- On Linux it's better to install Python & pip via your package manager. - On Linux it's better to install Python & pip via your package manager.
- On macOS it's also possible to install (a more recent version of) Python via [Brew](https://brew.sh/). - On macOS it's also possible to install (a more recent version of) Python via [Brew](https://brew.sh/).
2. Install Pesterchum's dependencies with pip, run: ``python -m pip install PyQt5 pygame`` 2. Install Pesterchum's dependencies with pip, run: ``python -m pip install PyQt6 pygame``
- If this fails, try running ``python -m pip install -U pip setuptools wheel`` to update pip, setuptools & wheel and then trying again. - If this fails, try running ``python -m pip install -U pip setuptools wheel`` to update pip, setuptools & wheel and then trying again.
3. Download [this repository's source](https://github.com/Dpeta/pesterchum-alt-servers/archive/refs/heads/py3_pyqt5.zip), or choose the "Source Code" option on any release, and extract the archive to a folder of your choice. 3. Download [this repository's source](https://github.com/Dpeta/pesterchum-alt-servers/archive/refs/heads/main.zip), or choose the "Source Code" option on any release, and extract the archive to a folder of your choice.
4. Navigate your terminal to the folder you chose with ``cd /folder/you/chose``. 4. Navigate your terminal to the folder you chose with ``cd /folder/you/chose``.
- For example, if you extracted it to your documents on Windows, run ``cd C:\Users\user\Documents\pesterchum-alt-servers-py3_pyqt5``. - For example, if you extracted it to your documents on Windows, run ``cd C:\Users\user\Documents\pesterchum-alt-servers-main``.
- Windows's cd command requires the /d flag to navigate to a different drive. (``cd D:\pesterchum-alt-servers-py3_pyqt5``) - Windows's cd command requires the /d flag to navigate to a different drive. (``cd D:\pesterchum-alt-servers-main``)
5. Run Pesterchum by running either ``pesterchum.py`` or ``python pesterchum.py``. 5. Run Pesterchum by running either ``pesterchum.py`` or ``python pesterchum.py``.
[Python 3]: https://www.python.org/downloads/ [Python 3]: https://www.python.org/downloads/
[pip]: https://pypi.org/project/pip/ [pip]: https://pypi.org/project/pip/
[PyQt5>=5.15]: https://pypi.org/project/PyQt5/ [PyQt6]: https://pypi.org/project/PyQt6/
[pygame]: https://pypi.org/project/pygame/ [pygame]: https://pypi.org/project/pygame/
## FREEZE / BUILD ## FREEZE / BUILD

View file

@ -9,7 +9,7 @@ import datetime
import logging import logging
import logging.config import logging.config
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import dataobjs import dataobjs
#import generic #import generic
@ -440,23 +440,23 @@ class ConsoleText(QtWidgets.QTextEdit):
# should. # should.
# karxi: Test for tab changing? # karxi: Test for tab changing?
if self.window().text.input: if self.window().text.input:
if event.key() not in (QtCore.Qt.Key_PageUp, QtCore.Qt.Key_PageDown, if event.key() not in (QtCore.Key.Qt.Key_PageUp, QtCore.Qt.Key.Key_PageDown,
QtCore.Qt.Key_Up, QtCore.Qt.Key_Down): QtCore.Qt.Key.Key_Up, QtCore.Qt.Key.Key_Down):
self.window().text.input.keyPressEvent(event) self.window().text.input.keyPressEvent(event)
super(ConsoleText, self).keyPressEvent(event) super(ConsoleText, self).keyPressEvent(event)
def mousePressEvent(self, event): def mousePressEvent(self, event):
if event.button() == QtCore.Qt.LeftButton: if event.button() == QtCore.Qt.MouseButton.LeftButton:
url = self.anchorAt(event.pos()) url = self.anchorAt(event.pos())
if url != "": if url != "":
# Skip memo/handle recognition # Skip memo/handle recognition
# NOTE: Ctrl+Click copies the URL. Maybe it should select it? # NOTE: Ctrl+Click copies the URL. Maybe it should select it?
if event.modifiers() == QtCore.Qt.ControlModifier: if event.modifiers() == QtCore.Qt.KeyboardModifier.ControlModifier:
QtWidgets.QApplication.clipboard().setText(url) QtWidgets.QApplication.clipboard().setText(url)
else: else:
# This'll probably be removed. May change the lexer out. # This'll probably be removed. May change the lexer out.
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.ParsingMode.TolerantMode))
super(ConsoleText, self).mousePressEvent(event) super(ConsoleText, self).mousePressEvent(event)
@ -464,14 +464,14 @@ class ConsoleText(QtWidgets.QTextEdit):
# Change our cursor when we roll over links (anchors). # Change our cursor when we roll over links (anchors).
super(ConsoleText, self).mouseMoveEvent(event) super(ConsoleText, self).mouseMoveEvent(event)
if self.anchorAt(event.pos()): if self.anchorAt(event.pos()):
if self.viewport().cursor().shape != QtCore.Qt.PointingHandCursor: if self.viewport().cursor().shape != QtCore.Qt.CursorShape.PointingHandCursor:
self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor))
else: else:
self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor)) self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.IBeamCursor))
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
textMenu = self.createStandardContextMenu() textMenu = self.createStandardContextMenu()
textMenu.exec_(event.globalPos()) textMenu.exec(event.globalPos())
class ConsoleInput(QtWidgets.QLineEdit): class ConsoleInput(QtWidgets.QLineEdit):
@ -504,16 +504,16 @@ class ConsoleInput(QtWidgets.QLineEdit):
# messing around in the console? Hm. # messing around in the console? Hm.
parent.mainwindow.idler.time = 0 parent.mainwindow.idler.time = 0
if evtkey == QtCore.Qt.Key_Up: if evtkey == QtCore.Qt.Key.Key_Up:
text = str(self.text()) text = str(self.text())
next = parent.text.history.next(text) next = parent.text.history.next(text)
if next is not None: if next is not None:
self.setText(next) self.setText(next)
elif evtkey == QtCore.Qt.Key_Down: elif evtkey == QtCore.Qt.Key.Key_Down:
prev = parent.text.history.prev() prev = parent.text.history.prev()
if prev is not None: if prev is not None:
self.setText(prev) self.setText(prev)
elif evtkey in (QtCore.Qt.Key_PageUp, QtCore.Qt.Key_PageDown): elif evtkey in (QtCore.Qt.Key.Key_PageUp, QtCore.Qt.Key.Key_PageDown):
parent.text.area.keyPressEvent(event) parent.text.area.keyPressEvent(event)
else: else:
super(ConsoleInput, self).keyPressEvent(event) super(ConsoleInput, self).keyPressEvent(event)

115
convo.py
View file

@ -7,7 +7,7 @@ PchumLog = logging.getLogger('pchumLogger')
from string import Template from string import Template
from time import strftime from time import strftime
from datetime import datetime, timedelta from datetime import datetime, timedelta
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
from dataobjs import PesterHistory from dataobjs import PesterHistory
from parsetools import convertTags, lexMessage, mecmd, colorBegin, colorEnd, \ from parsetools import convertTags, lexMessage, mecmd, colorBegin, colorEnd, \
@ -19,8 +19,8 @@ from pnc.dep.attrdict import AttrDict
class PesterTabWindow(QtWidgets.QFrame): class PesterTabWindow(QtWidgets.QFrame):
def __init__(self, mainwindow, parent=None, convo="convo"): def __init__(self, mainwindow, parent=None, convo="convo"):
super(PesterTabWindow, self).__init__(parent) super(PesterTabWindow, self).__init__(parent)
self.setAttribute(QtCore.Qt.WA_QuitOnClose, False) self.setAttribute(QtCore.Qt.WidgetAttribute.WA_QuitOnClose, False)
self.setFocusPolicy(QtCore.Qt.ClickFocus) self.setFocusPolicy(QtCore.Qt.FocusPolicy.ClickFocus)
self.mainwindow = mainwindow self.mainwindow = mainwindow
self.tabs = QtWidgets.QTabBar(self) self.tabs = QtWidgets.QTabBar(self)
@ -31,19 +31,19 @@ class PesterTabWindow(QtWidgets.QFrame):
self.tabs.tabMoved[int, int].connect(self.tabMoved) self.tabs.tabMoved[int, int].connect(self.tabMoved)
self.shortcuts = AttrDict() self.shortcuts = AttrDict()
self.shortcuts.tabNext = QtWidgets.QShortcut( self.shortcuts.tabNext = QtGui.QShortcut(
QtGui.QKeySequence('Ctrl+j'), self, QtGui.QKeySequence('Ctrl+j'), self,
context=QtCore.Qt.WidgetWithChildrenShortcut) context=QtCore.Qt.ShortcutContext.WidgetWithChildrenShortcut)
self.shortcuts.tabLast = QtWidgets.QShortcut( self.shortcuts.tabLast = QtGui.QShortcut(
QtGui.QKeySequence('Ctrl+k'), self, QtGui.QKeySequence('Ctrl+k'), self,
context=QtCore.Qt.WidgetWithChildrenShortcut) context=QtCore.Qt.ShortcutContext.WidgetWithChildrenShortcut)
# Note that we use reversed keys here. # Note that we use reversed keys here.
self.shortcuts.tabUp = QtWidgets.QShortcut( self.shortcuts.tabUp = QtGui.QShortcut(
QtGui.QKeySequence('Ctrl+PgDown'), self, QtGui.QKeySequence('Ctrl+PgDown'), self,
context=QtCore.Qt.WidgetWithChildrenShortcut) context=QtCore.Qt.ShortcutContext.WidgetWithChildrenShortcut)
self.shortcuts.tabDn = QtWidgets.QShortcut( self.shortcuts.tabDn = QtGui.QShortcut(
QtGui.QKeySequence('Ctrl+PgUp'), self, QtGui.QKeySequence('Ctrl+PgUp'), self,
context=QtCore.Qt.WidgetWithChildrenShortcut) context=QtCore.Qt.ShortcutContext.WidgetWithChildrenShortcut)
self.shortcuts.tabNext.activated.connect(self.nudgeTabNext) self.shortcuts.tabNext.activated.connect(self.nudgeTabNext)
self.shortcuts.tabUp.activated.connect(self.nudgeTabNext) self.shortcuts.tabUp.activated.connect(self.nudgeTabNext)
@ -106,8 +106,8 @@ class PesterTabWindow(QtWidgets.QFrame):
# TODO: Clean this up. Our text areas now call this. # TODO: Clean this up. Our text areas now call this.
keypress = event.key() keypress = event.key()
mods = event.modifiers() mods = event.modifiers()
if ((mods & QtCore.Qt.ControlModifier) and if ((mods & QtCore.Qt.KeyboardModifier.ControlModifier) and
keypress == QtCore.Qt.Key_Tab): keypress == QtCore.Qt.Key.Key_Tab):
handles = list(self.convos.keys()) handles = list(self.convos.keys())
waiting = self.mainwindow.waitingMessages.waitingHandles() waiting = self.mainwindow.waitingMessages.waitingHandles()
waitinghandles = list(set(handles) & set(waiting)) waitinghandles = list(set(handles) & set(waiting))
@ -125,9 +125,9 @@ class PesterTabWindow(QtWidgets.QFrame):
def nudgeTabIndex(self, direction): def nudgeTabIndex(self, direction):
# Inverted controls. Might add an option for this if people want # Inverted controls. Might add an option for this if people want
# it. # it.
#~if keypress == QtCore.Qt.Key_PageDown: #~if keypress == QtCore.Qt.Key.Key_PageDown:
#~ direction = 1 #~ direction = 1
#~elif keypress == QtCore.Qt.Key_PageUp: #~elif keypress == QtCore.Qt.Key.Key_PageUp:
#~ direction = -1 #~ direction = -1
# ...Processing... # ...Processing...
tabs = self.tabs tabs = self.tabs
@ -152,7 +152,7 @@ class PesterTabWindow(QtWidgets.QFrame):
tabs.setCurrentIndex(nind) tabs.setCurrentIndex(nind)
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
#~if event.reason() == QtGui.QContextMenuEvent.Mouse: #~if event.reason() == QtGui.QContextMenuEvent.Reason.Mouse:
tabi = self.tabs.tabAt(event.pos()) tabi = self.tabs.tabAt(event.pos())
if tabi < 0: if tabi < 0:
tabi = self.tabs.currentIndex() tabi = self.tabs.currentIndex()
@ -224,7 +224,7 @@ class PesterTabWindow(QtWidgets.QFrame):
def initTheme(self, theme): def initTheme(self, theme):
self.resize(*theme["convo/size"]) self.resize(*theme["convo/size"])
self.setStyleSheet(theme["convo/tabwindow/style"]) self.setStyleSheet(theme["convo/tabwindow/style"])
self.tabs.setShape(theme["convo/tabs/tabstyle"]) self.tabs.setShape(QtWidgets.QTabBar.Shape(theme["convo/tabs/tabstyle"]))
self.tabs.setStyleSheet("QTabBar::tab{ %s } QTabBar::tab:selected { %s }" % (theme["convo/tabs/style"], theme["convo/tabs/selectedstyle"])) self.tabs.setStyleSheet("QTabBar::tab{ %s } QTabBar::tab:selected { %s }" % (theme["convo/tabs/style"], theme["convo/tabs/selectedstyle"]))
def changeTheme(self, theme): def changeTheme(self, theme):
@ -314,12 +314,13 @@ class PesterMovie(QtGui.QMovie):
if text.hasTabs: if text.hasTabs:
i = text.tabobject.tabIndices[text.parent().title()] i = text.tabobject.tabIndices[text.parent().title()]
if text.tabobject.tabs.currentIndex() == i: if text.tabobject.tabs.currentIndex() == i:
text.document().addResource(QtGui.QTextDocument.ImageResource, text.document().addResource(QtGui.QTextDocument.ResourceType.ImageResource.value,
text.urls[movie], movie.currentPixmap()) text.urls[movie], movie.currentPixmap())
text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth()) text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth())
else: else:
text.document().addResource(QtGui.QTextDocument.ImageResource, text.document().addResource(QtGui.QTextDocument.ResourceType.ImageResource.value,
text.urls[movie], movie.currentPixmap()) text.urls[movie],
movie.currentPixmap())
text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth()) text.setLineWrapColumnOrWidth(text.lineWrapColumnOrWidth())
@ -396,7 +397,7 @@ class PesterText(QtWidgets.QTextEdit):
if self.mainwindow.config.animations(): if self.mainwindow.config.animations():
for m in self.urls: for m in self.urls:
if convertTags(lexmsg).find(self.urls[m].toString()) != -1: if convertTags(lexmsg).find(self.urls[m].toString()) != -1:
if m.state() == QtGui.QMovie.NotRunning: if m.state() == QtGui.QMovie.MovieState.NotRunning:
m.start() m.start()
if self.parent().mainwindow.config.showTimeStamps(): if self.parent().mainwindow.config.showTimeStamps():
if self.parent().mainwindow.config.time12Format(): if self.parent().mainwindow.config.time12Format():
@ -486,8 +487,8 @@ class PesterText(QtWidgets.QTextEdit):
def keyPressEvent(self, event): def keyPressEvent(self, event):
# First parent is the PesterConvo containing this. # First parent is the PesterConvo containing this.
# Second parent is the PesterTabWindow containing *it*. # Second parent is the PesterTabWindow containing *it*.
pass_to_super = (QtCore.Qt.Key_PageUp, QtCore.Qt.Key_PageDown, pass_to_super = (QtCore.Qt.Key.Key_PageUp, QtCore.Qt.Key.Key_PageDown,
QtCore.Qt.Key_Up, QtCore.Qt.Key_Down) QtCore.Qt.Key.Key_Up, QtCore.Qt.Key.Key_Down)
parent = self.parent() parent = self.parent()
key = event.key() key = event.key()
#keymods = event.modifiers() #keymods = event.modifiers()
@ -499,7 +500,7 @@ class PesterText(QtWidgets.QTextEdit):
super(PesterText, self).keyPressEvent(event) super(PesterText, self).keyPressEvent(event)
def mousePressEvent(self, event): def mousePressEvent(self, event):
if event.button() == QtCore.Qt.LeftButton: if event.button() == QtCore.Qt.MouseButton.LeftButton:
url = self.anchorAt(event.pos()) url = self.anchorAt(event.pos())
if url != "": if url != "":
if url[0] == "#" and url != "#pesterchum": if url[0] == "#" and url != "#pesterchum":
@ -508,22 +509,22 @@ class PesterText(QtWidgets.QTextEdit):
handle = str(url[1:]) handle = str(url[1:])
self.parent().mainwindow.newConversation(handle) self.parent().mainwindow.newConversation(handle)
else: else:
if event.modifiers() == QtCore.Qt.ControlModifier: if event.modifiers() == QtCore.Qt.KeyboardModifier.ControlModifier:
QtWidgets.QApplication.clipboard().setText(url) QtWidgets.QApplication.clipboard().setText(url)
else: else:
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.ParsingMode.TolerantMode))
QtWidgets.QTextEdit.mousePressEvent(self, event) QtWidgets.QTextEdit.mousePressEvent(self, event)
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
QtWidgets.QTextEdit.mouseMoveEvent(self, event) QtWidgets.QTextEdit.mouseMoveEvent(self, event)
if self.anchorAt(event.pos()): if self.anchorAt(event.pos()):
if self.viewport().cursor().shape != QtCore.Qt.PointingHandCursor: if self.viewport().cursor().shape != QtCore.Qt.CursorShape.PointingHandCursor:
self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor))
else: else:
self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor)) self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.IBeamCursor))
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
textMenu = self.createStandardContextMenu() textMenu = self.createStandardContextMenu()
textMenu.exec_(event.globalPos()) textMenu.exec(event.globalPos())
class PesterInput(QtWidgets.QLineEdit): class PesterInput(QtWidgets.QLineEdit):
stylesheet_path = "convo/input/style" stylesheet_path = "convo/input/style"
@ -544,16 +545,16 @@ class PesterInput(QtWidgets.QLineEdit):
self.parent().textArea.textCursor().clearSelection() self.parent().textArea.textCursor().clearSelection()
super(PesterInput, self).focusInEvent(event) super(PesterInput, self).focusInEvent(event)
def keyPressEvent(self, event): def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Up: if event.key() == QtCore.Qt.Key.Key_Up:
text = str(self.text()) text = str(self.text())
next = self.parent().history.next(text) next = self.parent().history.next(text)
if next is not None: if next is not None:
self.setText(next) self.setText(next)
elif event.key() == QtCore.Qt.Key_Down: elif event.key() == QtCore.Qt.Key.Key_Down:
prev = self.parent().history.prev() prev = self.parent().history.prev()
if prev is not None: if prev is not None:
self.setText(prev) self.setText(prev)
elif event.key() in [QtCore.Qt.Key_PageUp, QtCore.Qt.Key_PageDown]: elif event.key() in [QtCore.Qt.Key.Key_PageUp, QtCore.Qt.Key.Key_PageDown]:
self.parent().textArea.keyPressEvent(event) self.parent().textArea.keyPressEvent(event)
self.parent().mainwindow.idler.time = 0 self.parent().mainwindow.idler.time = 0
super(PesterInput, self).keyPressEvent(event) super(PesterInput, self).keyPressEvent(event)
@ -561,9 +562,9 @@ class PesterInput(QtWidgets.QLineEdit):
class PesterConvo(QtWidgets.QFrame): class PesterConvo(QtWidgets.QFrame):
def __init__(self, chum, initiated, mainwindow, parent=None): def __init__(self, chum, initiated, mainwindow, parent=None):
super(PesterConvo, self).__init__(parent) super(PesterConvo, self).__init__(parent)
self.setAttribute(QtCore.Qt.WA_QuitOnClose, False) self.setAttribute(QtCore.Qt.WidgetAttribute.WA_QuitOnClose, False)
self.setObjectName(chum.handle) self.setObjectName(chum.handle)
self.setFocusPolicy(QtCore.Qt.ClickFocus) self.setFocusPolicy(QtCore.Qt.FocusPolicy.ClickFocus)
self.chum = chum self.chum = chum
self.mainwindow = mainwindow self.mainwindow = mainwindow
theme = self.mainwindow.theme theme = self.mainwindow.theme
@ -579,7 +580,7 @@ class PesterConvo(QtWidgets.QFrame):
self.chumLabel.setAlignment(self.aligndict["h"][self.mainwindow.theme["convo/chumlabel/align/h"]] | self.aligndict["v"][self.mainwindow.theme["convo/chumlabel/align/v"]]) self.chumLabel.setAlignment(self.aligndict["h"][self.mainwindow.theme["convo/chumlabel/align/h"]] | self.aligndict["v"][self.mainwindow.theme["convo/chumlabel/align/v"]])
self.chumLabel.setMaximumHeight(self.mainwindow.theme["convo/chumlabel/maxheight"]) self.chumLabel.setMaximumHeight(self.mainwindow.theme["convo/chumlabel/maxheight"])
self.chumLabel.setMinimumHeight(self.mainwindow.theme["convo/chumlabel/minheight"]) self.chumLabel.setMinimumHeight(self.mainwindow.theme["convo/chumlabel/minheight"])
self.chumLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)) self.chumLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding))
self.textArea = PesterText(self.mainwindow.theme, self) self.textArea = PesterText(self.mainwindow.theme, self)
self.textInput = PesterInput(self.mainwindow.theme, self) self.textInput = PesterInput(self.mainwindow.theme, self)
self.textInput.setFocus() self.textInput.setFocus()
@ -599,21 +600,21 @@ class PesterConvo(QtWidgets.QFrame):
self.optionsMenu = QtWidgets.QMenu(self) self.optionsMenu = QtWidgets.QMenu(self)
self.optionsMenu.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) self.optionsMenu.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
self.addChumAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self) self.addChumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self)
self.addChumAction.triggered.connect(self.addThisChum) self.addChumAction.triggered.connect(self.addThisChum)
self.blockAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/blockchum"], self) self.blockAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/blockchum"], self)
self.blockAction.triggered.connect(self.blockThisChum) self.blockAction.triggered.connect(self.blockThisChum)
self.quirksOff = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/quirksoff"], self) self.quirksOff = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/quirksoff"], self)
self.quirksOff.setCheckable(True) self.quirksOff.setCheckable(True)
self.quirksOff.toggled[bool].connect(self.toggleQuirks) self.quirksOff.toggled[bool].connect(self.toggleQuirks)
self.oocToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/ooc"], self) self.oocToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/ooc"], self)
self.oocToggle.setCheckable(True) self.oocToggle.setCheckable(True)
self.oocToggle.toggled[bool].connect(self.toggleOOC) self.oocToggle.toggled[bool].connect(self.toggleOOC)
self.unblockchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self) self.unblockchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self)
self.unblockchum.triggered.connect(self.unblockChumSlot) self.unblockchum.triggered.connect(self.unblockChumSlot)
self.reportchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self) self.reportchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self)
self.reportchum.triggered.connect(self.reportThisChum) self.reportchum.triggered.connect(self.reportThisChum)
self.logchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self) self.logchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self)
self.logchum.triggered.connect(self.openChumLogs) self.logchum.triggered.connect(self.openChumLogs)
# For this, we'll want to use setChecked to toggle these so they match # For this, we'll want to use setChecked to toggle these so they match
@ -626,25 +627,25 @@ class PesterConvo(QtWidgets.QFrame):
# Theme support :3c # Theme support :3c
#if self.mainwindow.theme.has_key("main/menus/rclickchumlist/beeponmessage"): #if self.mainwindow.theme.has_key("main/menus/rclickchumlist/beeponmessage"):
try: try:
self._beepToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/beeponmessage"], self) self._beepToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/beeponmessage"], self)
except: except:
self._beepToggle = QtWidgets.QAction("BEEP ON MESSAGE", self) self._beepToggle = QtGui.QAction("BEEP ON MESSAGE", self)
self._beepToggle.setCheckable(True) self._beepToggle.setCheckable(True)
self._beepToggle.toggled[bool].connect(self.toggleBeep) self._beepToggle.toggled[bool].connect(self.toggleBeep)
#if self.mainwindow.theme.has_key("main/menus/rclickchumlist/flashonmessage"): #if self.mainwindow.theme.has_key("main/menus/rclickchumlist/flashonmessage"):
try: try:
self._flashToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/flashonmessage"], self) self._flashToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/flashonmessage"], self)
except: except:
self._flashToggle = QtWidgets.QAction("FLASH ON MESSAGE", self) self._flashToggle = QtGui.QAction("FLASH ON MESSAGE", self)
self._flashToggle.setCheckable(True) self._flashToggle.setCheckable(True)
self._flashToggle.toggled[bool].connect(self.toggleFlash) self._flashToggle.toggled[bool].connect(self.toggleFlash)
#if self.mainwindow.theme.has_key("main/menus/rclickchumlist/mutenotifications"): #if self.mainwindow.theme.has_key("main/menus/rclickchumlist/mutenotifications"):
try: try:
self._muteToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/mutenotifications"], self) self._muteToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/mutenotifications"], self)
except: except:
self._muteToggle = QtWidgets.QAction("MUTE NOTIFICATIONS", self) self._muteToggle = QtGui.QAction("MUTE NOTIFICATIONS", self)
self._muteToggle.setCheckable(True) self._muteToggle.setCheckable(True)
self._muteToggle.toggled[bool].connect(self.toggleMute) self._muteToggle.toggled[bool].connect(self.toggleMute)
@ -817,7 +818,7 @@ class PesterConvo(QtWidgets.QFrame):
self.parent().showChat(self.title()) self.parent().showChat(self.title())
self.raiseChat() self.raiseChat()
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
if event.reason() == QtGui.QContextMenuEvent.Mouse: if event.reason() == QtGui.QContextMenuEvent.Reason.Mouse:
self.optionsMenu.popup(event.globalPos()) self.optionsMenu.popup(event.globalPos())
def closeEvent(self, event): def closeEvent(self, event):
self.mainwindow.waitingMessages.messageAnswered(self.title()) self.mainwindow.waitingMessages.messageAnswered(self.title())
@ -844,7 +845,7 @@ class PesterConvo(QtWidgets.QFrame):
self.chumLabel.setAlignment(self.aligndict["h"][self.mainwindow.theme["convo/chumlabel/align/h"]] | self.aligndict["v"][self.mainwindow.theme["convo/chumlabel/align/v"]]) self.chumLabel.setAlignment(self.aligndict["h"][self.mainwindow.theme["convo/chumlabel/align/h"]] | self.aligndict["v"][self.mainwindow.theme["convo/chumlabel/align/v"]])
self.chumLabel.setMaximumHeight(self.mainwindow.theme["convo/chumlabel/maxheight"]) self.chumLabel.setMaximumHeight(self.mainwindow.theme["convo/chumlabel/maxheight"])
self.chumLabel.setMinimumHeight(self.mainwindow.theme["convo/chumlabel/minheight"]) self.chumLabel.setMinimumHeight(self.mainwindow.theme["convo/chumlabel/minheight"])
self.chumLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)) self.chumLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Expanding))
self.quirksOff.setText(self.mainwindow.theme["main/menus/rclickchumlist/quirksoff"]) self.quirksOff.setText(self.mainwindow.theme["main/menus/rclickchumlist/quirksoff"])
self.addChumAction.setText(self.mainwindow.theme["main/menus/rclickchumlist/addchum"]) self.addChumAction.setText(self.mainwindow.theme["main/menus/rclickchumlist/addchum"])
self.blockAction.setText(self.mainwindow.theme["main/menus/rclickchumlist/blockchum"]) self.blockAction.setText(self.mainwindow.theme["main/menus/rclickchumlist/blockchum"])
@ -929,12 +930,12 @@ class PesterConvo(QtWidgets.QFrame):
messageSent = QtCore.pyqtSignal('QString', 'QString') messageSent = QtCore.pyqtSignal('QString', 'QString')
windowClosed = QtCore.pyqtSignal('QString') windowClosed = QtCore.pyqtSignal('QString')
aligndict = {"h": {"center": QtCore.Qt.AlignHCenter, aligndict = {"h": {"center": QtCore.Qt.AlignmentFlag.AlignHCenter,
"left": QtCore.Qt.AlignLeft, "left": QtCore.Qt.AlignmentFlag.AlignLeft,
"right": QtCore.Qt.AlignRight }, "right": QtCore.Qt.AlignmentFlag.AlignRight },
"v": {"center": QtCore.Qt.AlignVCenter, "v": {"center": QtCore.Qt.AlignmentFlag.AlignVCenter,
"top": QtCore.Qt.AlignTop, "top": QtCore.Qt.AlignmentFlag.AlignTop,
"bottom": QtCore.Qt.AlignBottom } } "bottom": QtCore.Qt.AlignmentFlag.AlignBottom } }
# the import is way down here to avoid recursive imports # the import is way down here to avoid recursive imports
from logviewer import PesterLogViewer from logviewer import PesterLogViewer

View file

@ -4,7 +4,7 @@ import ostools
_datadir = ostools.getDataDir() _datadir = ostools.getDataDir()
logging.config.fileConfig(_datadir + "logging.ini") logging.config.fileConfig(_datadir + "logging.ini")
PchumLog = logging.getLogger('pchumLogger') PchumLog = logging.getLogger('pchumLogger')
from PyQt5 import QtGui from PyQt6 import QtGui
from datetime import datetime from datetime import datetime
import re import re
import random import random

View file

@ -1,4 +1,4 @@
from PyQt5 import QtGui, QtWidgets from PyQt6 import QtGui, QtWidgets
from datetime import timedelta from datetime import timedelta
class mysteryTime(timedelta): class mysteryTime(timedelta):
@ -44,7 +44,7 @@ class PesterIcon(QtGui.QIcon):
class RightClickList(QtWidgets.QListWidget): class RightClickList(QtWidgets.QListWidget):
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
#fuckin Qt <--- I feel that </3 #fuckin Qt <--- I feel that </3
if event.reason() == QtGui.QContextMenuEvent.Mouse: if event.reason() == QtGui.QContextMenuEvent.Reason.Mouse:
listing = self.itemAt(event.pos()) listing = self.itemAt(event.pos())
self.setCurrentItem(listing) self.setCurrentItem(listing)
optionsMenu = self.getOptionsMenu() optionsMenu = self.getOptionsMenu()
@ -55,7 +55,7 @@ class RightClickList(QtWidgets.QListWidget):
class RightClickTree(QtWidgets.QTreeWidget): class RightClickTree(QtWidgets.QTreeWidget):
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
if event.reason() == QtGui.QContextMenuEvent.Mouse: if event.reason() == QtGui.QContextMenuEvent.Reason.Mouse:
listing = self.itemAt(event.pos()) listing = self.itemAt(event.pos())
self.setCurrentItem(listing) self.setCurrentItem(listing)
optionsMenu = self.getOptionsMenu() optionsMenu = self.getOptionsMenu()
@ -95,8 +95,8 @@ class MultiTextDialog(QtWidgets.QDialog):
self.setLayout(layout_0) self.setLayout(layout_0)
def getText(self): def getText(self):
r = self.exec_() r = self.exec()
if r == QtWidgets.QDialog.Accepted: if r == QtWidgets.QDialog.DialogCode.Accepted:
retval = {} retval = {}
for (name, widget) in self.inputs.items(): for (name, widget) in self.inputs.items():
retval[name] = str(widget.text()) retval[name] = str(widget.text())
@ -128,7 +128,7 @@ class MovingWindow(QtWidgets.QFrame):
if event.button() == 1: if event.button() == 1:
self.moving = event.globalPos() - self.pos() self.moving = event.globalPos() - self.pos()
except AttributeError as e: except AttributeError as e:
print("PyQt5 <= 5.14?") print("PyQt6 <= 5.14?")
print(str(e)) print(str(e))
if event.button() == 1: if event.button() == 1:
self.moving = event.globalPos() - self.pos() self.moving = event.globalPos() - self.pos()

2
irc.py
View file

@ -5,7 +5,7 @@ import random
import time import time
import json import json
from PyQt5 import QtCore, QtGui from PyQt6 import QtCore, QtGui
import ostools import ostools
from mood import Mood from mood import Mood

View file

@ -3,7 +3,7 @@ import codecs
import re import re
import ostools import ostools
from time import strftime, strptime from time import strftime, strptime
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
from generic import RightClickList, RightClickTree from generic import RightClickList, RightClickTree
from parsetools import convertTags from parsetools import convertTags
from convo import PesterText from convo import PesterText
@ -17,7 +17,7 @@ class PesterLogSearchInput(QtWidgets.QLineEdit):
def keyPressEvent(self, event): def keyPressEvent(self, event):
QtWidgets.QLineEdit.keyPressEvent(self, event) QtWidgets.QLineEdit.keyPressEvent(self, event)
if hasattr(self.parent(), 'textArea'): if hasattr(self.parent(), 'textArea'):
if event.key() == QtCore.Qt.Key_Return: if event.key() == QtCore.Qt.Key.Key_Return:
self.parent().logSearch(self.text()) self.parent().logSearch(self.text())
if self.parent().textArea.find(self.text()): if self.parent().textArea.find(self.text()):
self.parent().textArea.ensureCursorVisible() self.parent().textArea.ensureCursorVisible()
@ -29,8 +29,8 @@ class PesterLogHighlighter(QtGui.QSyntaxHighlighter):
QtGui.QSyntaxHighlighter.__init__(self, parent) QtGui.QSyntaxHighlighter.__init__(self, parent)
self.searchTerm = "" self.searchTerm = ""
self.hilightstyle = QtGui.QTextCharFormat() self.hilightstyle = QtGui.QTextCharFormat()
self.hilightstyle.setBackground(QtGui.QBrush(QtCore.Qt.green)) self.hilightstyle.setBackground(QtGui.QBrush(QtCore.Qt.GlobalColor.green))
self.hilightstyle.setForeground(QtGui.QBrush(QtCore.Qt.black)) self.hilightstyle.setForeground(QtGui.QBrush(QtCore.Qt.GlobalColor.black))
def highlightBlock(self, text): def highlightBlock(self, text):
for i in range(0, len(text)-(len(self.searchTerm)-1)): for i in range(0, len(text)-(len(self.searchTerm)-1)):
if str(text[i:i+len(self.searchTerm)]).lower() == str(self.searchTerm).lower(): if str(text[i:i+len(self.searchTerm)]).lower() == str(self.searchTerm).lower():
@ -97,7 +97,7 @@ class PesterLogUserSelect(QtWidgets.QDialog):
return self.chumsBox.currentItem() return self.chumsBox.currentItem()
def logSearch(self, search): def logSearch(self, search):
found = self.chumsBox.findItems(search, QtCore.Qt.MatchStartsWith) found = self.chumsBox.findItems(search, QtCore.Qt.MatchFlag.MatchStartsWith)
if len(found) > 0 and len(found) < self.chumsBox.count(): if len(found) > 0 and len(found) < self.chumsBox.count():
self.chumsBox.setCurrentItem(found[0]) self.chumsBox.setCurrentItem(found[0])
@ -121,7 +121,7 @@ class PesterLogUserSelect(QtWidgets.QDialog):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def openDir(self): def openDir(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(_datadir, "logs"), QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(_datadir, "logs"), QtCore.QUrl.ParsingMode.TolerantMode))
class PesterLogViewer(QtWidgets.QDialog): class PesterLogViewer(QtWidgets.QDialog):
def __init__(self, chum, config, theme, parent): def __init__(self, chum, config, theme, parent):
@ -217,7 +217,7 @@ class PesterLogViewer(QtWidgets.QDialog):
self.ok.clicked.connect(self.reject) self.ok.clicked.connect(self.reject)
layout_ok = QtWidgets.QHBoxLayout() layout_ok = QtWidgets.QHBoxLayout()
layout_ok.addWidget(self.ok) layout_ok.addWidget(self.ok)
layout_ok.setAlignment(self.ok, QtCore.Qt.AlignRight) layout_ok.setAlignment(self.ok, QtCore.Qt.AlignmentFlag.AlignRight)
layout_logs = QtWidgets.QHBoxLayout() layout_logs = QtWidgets.QHBoxLayout()
layout_logs.addWidget(self.tree) layout_logs.addWidget(self.tree)
@ -246,7 +246,7 @@ class PesterLogViewer(QtWidgets.QDialog):
cline = re.sub("\[color=(#.{6})]", r"<c=\1>", cline) cline = re.sub("\[color=(#.{6})]", r"<c=\1>", cline)
self.textArea.append(convertTags(cline)) self.textArea.append(convertTags(cline))
textCur = self.textArea.textCursor() textCur = self.textArea.textCursor()
textCur.movePosition(1) #textCur.movePosition(1)
self.textArea.setTextCursor(textCur) self.textArea.setTextCursor(textCur)
self.instructions.setText("Pesterlog with " +self.chum+ " on " + self.fileToTime(str(fname))) self.instructions.setText("Pesterlog with " +self.chum+ " on " + self.fileToTime(str(fname)))
@ -278,19 +278,19 @@ class PesterLogText(PesterText):
handle = str(url[1:]) handle = str(url[1:])
self.parent().parent.newConversation(handle) self.parent().parent.newConversation(handle)
else: else:
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.ParsingMode.TolerantMode))
QtWidgets.QTextEdit.mousePressEvent(self, event) QtWidgets.QTextEdit.mousePressEvent(self, event)
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
QtWidgets.QTextEdit.mouseMoveEvent(self, event) QtWidgets.QTextEdit.mouseMoveEvent(self, event)
if self.anchorAt(event.pos()): if self.anchorAt(event.pos()):
if self.viewport().cursor().shape != QtCore.Qt.PointingHandCursor: if self.viewport().cursor().shape != QtCore.Qt.CursorShape.PointingHandCursor:
self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor))
else: else:
self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor)) self.viewport().setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.IBeamCursor))
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
textMenu = self.createStandardContextMenu() textMenu = self.createStandardContextMenu()
a = textMenu.actions() a = textMenu.actions()
a[0].setText("Copy Plain Text") a[0].setText("Copy Plain Text")
a[0].setShortcut(self.tr("Ctrl+C")) a[0].setShortcut(self.tr("Ctrl+C"))
textMenu.exec_(event.globalPos()) textMenu.exec(event.globalPos())

View file

@ -10,7 +10,7 @@ import os
import sys import sys
import re import re
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import ostools import ostools
from quirks import ScriptQuirks from quirks import ScriptQuirks

View file

@ -4,7 +4,7 @@ import re
from string import Template from string import Template
from datetime import timedelta, datetime from datetime import timedelta, datetime
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import ostools import ostools
import parsetools import parsetools
@ -302,7 +302,7 @@ class MemoText(PesterText):
if self.mainwindow.config.animations(): if self.mainwindow.config.animations():
for m in self.urls: for m in self.urls:
if convertTags(lexmsg).find(self.urls[m].toString()) != -1: if convertTags(lexmsg).find(self.urls[m].toString()) != -1:
if m.state() == QtGui.QMovie.NotRunning: if m.state() == QtGui.QMovie.MovieState.NotRunning:
m.start() m.start()
chumdb = window.chumdb chumdb = window.chumdb
if chum is not me: # SO MUCH WH1T3SP4C3 >:] if chum is not me: # SO MUCH WH1T3SP4C3 >:]
@ -375,14 +375,14 @@ class PesterMemo(PesterConvo):
# TODO: Clean up inheritance between these!! The inits are ugly. # TODO: Clean up inheritance between these!! The inits are ugly.
def __init__(self, channel, timestr, mainwindow, parent=None): def __init__(self, channel, timestr, mainwindow, parent=None):
QtWidgets.QFrame.__init__(self, parent) QtWidgets.QFrame.__init__(self, parent)
self.setAttribute(QtCore.Qt.WA_QuitOnClose, False) self.setAttribute(QtCore.Qt.WidgetAttribute.WA_QuitOnClose, False)
self.channel = channel self.channel = channel
self.setObjectName(self.channel) self.setObjectName(self.channel)
self.mainwindow = mainwindow self.mainwindow = mainwindow
self.time = TimeTracker(txt2delta(timestr)) self.time = TimeTracker(txt2delta(timestr))
self.setWindowTitle(channel) self.setWindowTitle(channel)
self.channelLabel = QtWidgets.QLabel(self) self.channelLabel = QtWidgets.QLabel(self)
self.channelLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)) self.channelLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Expanding))
self.textArea = MemoText(self.mainwindow.theme, self) self.textArea = MemoText(self.mainwindow.theme, self)
self.textInput = MemoInput(self.mainwindow.theme, self) self.textInput = MemoInput(self.mainwindow.theme, self)
@ -395,19 +395,19 @@ class PesterMemo(PesterConvo):
self.userlist = RightClickList(self) self.userlist = RightClickList(self)
self.userlist.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)) self.userlist.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding))
self.userlist.optionsMenu = QtWidgets.QMenu(self) self.userlist.optionsMenu = QtWidgets.QMenu(self)
self.pesterChumAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self) self.pesterChumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self)
self.pesterChumAction.triggered.connect(self.newPesterSlot) self.pesterChumAction.triggered.connect(self.newPesterSlot)
self.addchumAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self) self.addchumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self)
self.addchumAction.triggered.connect(self.addChumSlot) self.addchumAction.triggered.connect(self.addChumSlot)
self.banuserAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/banuser"], self) self.banuserAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/banuser"], self)
self.banuserAction.triggered.connect(self.banSelectedUser) self.banuserAction.triggered.connect(self.banSelectedUser)
self.opAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/opuser"], self) self.opAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/opuser"], self)
self.opAction.triggered.connect(self.opSelectedUser) self.opAction.triggered.connect(self.opSelectedUser)
self.voiceAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/voiceuser"], self) self.voiceAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/voiceuser"], self)
self.voiceAction.triggered.connect(self.voiceSelectedUser) self.voiceAction.triggered.connect(self.voiceSelectedUser)
self.quirkDisableAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/quirkkill"], self) self.quirkDisableAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/quirkkill"], self)
self.quirkDisableAction.triggered.connect(self.killQuirkUser) self.quirkDisableAction.triggered.connect(self.killQuirkUser)
self.userlist.optionsMenu.addAction(self.pesterChumAction) self.userlist.optionsMenu.addAction(self.pesterChumAction)
self.userlist.optionsMenu.addAction(self.addchumAction) self.userlist.optionsMenu.addAction(self.addchumAction)
@ -416,38 +416,38 @@ class PesterMemo(PesterConvo):
self.optionsMenu = QtWidgets.QMenu(self) self.optionsMenu = QtWidgets.QMenu(self)
self.optionsMenu.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) # So it doesn't inherit the memo's background image. self.optionsMenu.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) # So it doesn't inherit the memo's background image.
# Fixes floating "PESTERLOG:" # Fixes floating "PESTERLOG:"
self.oocToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/ooc"], self) self.oocToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/ooc"], self)
self.oocToggle.setCheckable(True) self.oocToggle.setCheckable(True)
self.oocToggle.toggled[bool].connect(self.toggleOOC) self.oocToggle.toggled[bool].connect(self.toggleOOC)
self.quirksOff = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/quirksoff"], self) self.quirksOff = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/quirksoff"], self)
self.quirksOff.setCheckable(True) self.quirksOff.setCheckable(True)
self.quirksOff.toggled[bool].connect(self.toggleQuirks) self.quirksOff.toggled[bool].connect(self.toggleQuirks)
self.logchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self) self.logchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self)
self.logchum.triggered.connect(self.openChumLogs) self.logchum.triggered.connect(self.openChumLogs)
self.invitechum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/invitechum"], self) self.invitechum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/invitechum"], self)
self.invitechum.triggered.connect(self.inviteChums) self.invitechum.triggered.connect(self.inviteChums)
#if self.mainwindow.theme.has_key("main/menus/rclickchumlist/beeponmessage"): #if self.mainwindow.theme.has_key("main/menus/rclickchumlist/beeponmessage"):
try: try:
self._beepToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/beeponmessage"], self) self._beepToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/beeponmessage"], self)
except: except:
self._beepToggle = QtWidgets.QAction("BEEP ON MESSAGE", self) self._beepToggle = QtGui.QAction("BEEP ON MESSAGE", self)
self._beepToggle.setCheckable(True) self._beepToggle.setCheckable(True)
self._beepToggle.toggled[bool].connect(self.toggleBeep) self._beepToggle.toggled[bool].connect(self.toggleBeep)
#if self.mainwindow.theme.has_key("main/menus/rclickchumlist/flashonmessage"): #if self.mainwindow.theme.has_key("main/menus/rclickchumlist/flashonmessage"):
try: try:
self._flashToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/flashonmessage"], self) self._flashToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/flashonmessage"], self)
except: except:
self._flashToggle = QtWidgets.QAction("FLASH ON MESSAGE", self) self._flashToggle = QtGui.QAction("FLASH ON MESSAGE", self)
self._flashToggle.setCheckable(True) self._flashToggle.setCheckable(True)
self._flashToggle.toggled[bool].connect(self.toggleFlash) self._flashToggle.toggled[bool].connect(self.toggleFlash)
#if self.mainwindow.theme.has_key("main/menus/rclickchumlist/mutenotifications"): #if self.mainwindow.theme.has_key("main/menus/rclickchumlist/mutenotifications"):
try: try:
self._muteToggle = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/mutenotifications"], self) self._muteToggle = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/mutenotifications"], self)
except: except:
self._muteToggle = QtWidgets.QAction("MUTE NOTIFICATIONS", self) self._muteToggle = QtGui.QAction("MUTE NOTIFICATIONS", self)
self._muteToggle.setCheckable(True) self._muteToggle.setCheckable(True)
self._muteToggle.toggled[bool].connect(self.toggleMute) self._muteToggle.toggled[bool].connect(self.toggleMute)
@ -462,16 +462,16 @@ class PesterMemo(PesterConvo):
self.optionsMenu.addAction(self.invitechum) self.optionsMenu.addAction(self.invitechum)
self.chanModeMenu = QtWidgets.QMenu(self.mainwindow.theme["main/menus/rclickchumlist/memosetting"], self) self.chanModeMenu = QtWidgets.QMenu(self.mainwindow.theme["main/menus/rclickchumlist/memosetting"], self)
self.chanNoquirks = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memonoquirk"], self) self.chanNoquirks = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memonoquirk"], self)
self.chanNoquirks.setCheckable(True) self.chanNoquirks.setCheckable(True)
self.chanNoquirks.toggled[bool].connect(self.noquirksChan) self.chanNoquirks.toggled[bool].connect(self.noquirksChan)
self.chanHide = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memohidden"], self) self.chanHide = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memohidden"], self)
self.chanHide.setCheckable(True) self.chanHide.setCheckable(True)
self.chanHide.toggled[bool].connect(self.hideChan) self.chanHide.toggled[bool].connect(self.hideChan)
self.chanInvite = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memoinvite"], self) self.chanInvite = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memoinvite"], self)
self.chanInvite.setCheckable(True) self.chanInvite.setCheckable(True)
self.chanInvite.toggled[bool].connect(self.inviteChan) self.chanInvite.toggled[bool].connect(self.inviteChan)
self.chanMod = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memomute"], self) self.chanMod = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/memomute"], self)
self.chanMod.setCheckable(True) self.chanMod.setCheckable(True)
self.chanMod.toggled[bool].connect(self.modChan) self.chanMod.toggled[bool].connect(self.modChan)
self.chanModeMenu.addAction(self.chanNoquirks) self.chanModeMenu.addAction(self.chanNoquirks)
@ -480,7 +480,7 @@ class PesterMemo(PesterConvo):
self.chanModeMenu.addAction(self.chanMod) self.chanModeMenu.addAction(self.chanMod)
self.chanModeMenu.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) # BWAH BWAH FLOATING "PESTERLOG:" self.chanModeMenu.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) # BWAH BWAH FLOATING "PESTERLOG:"
self.timeslider = TimeSlider(QtCore.Qt.Horizontal, self) self.timeslider = TimeSlider(QtCore.Qt.Orientation.Horizontal, self)
self.timeinput = TimeInput(self.timeslider, self) self.timeinput = TimeInput(self.timeslider, self)
self.timeinput.setText(timestr) self.timeinput.setText(timestr)
self.timeinput.setSlider() self.timeinput.setSlider()
@ -511,7 +511,7 @@ class PesterMemo(PesterConvo):
layout_1.addWidget(self.userlist) layout_1.addWidget(self.userlist)
# layout_1 = QtGui.QGridLayout() # layout_1 = QtGui.QGridLayout()
# layout_1.addWidget(self.timeslider, 0, 1, QtCore.Qt.AlignHCenter) # layout_1.addWidget(self.timeslider, 0, 1, QtCore.Qt.AlignmentFlag.AlignHCenter)
# layout_1.addWidget(self.timeinput, 1, 0, 1, 3) # layout_1.addWidget(self.timeinput, 1, 0, 1, 3)
layout_2 = QtWidgets.QHBoxLayout() layout_2 = QtWidgets.QHBoxLayout()
layout_2.addWidget(self.timeslider) layout_2.addWidget(self.timeslider)
@ -582,7 +582,7 @@ class PesterMemo(PesterConvo):
def updateBlocked(self): def updateBlocked(self):
pass pass
def updateColor(self, handle, color): def updateColor(self, handle, color):
chums = self.userlist.findItems(handle, QtCore.Qt.MatchFlags(0)) chums = self.userlist.findItems(handle, QtCore.Qt.MatchFlag.MatchExactly)
for c in chums: for c in chums:
c.setForeground(QtGui.QBrush(color)) c.setForeground(QtGui.QBrush(color))
def addMessage(self, text, handle): def addMessage(self, text, handle):
@ -1101,10 +1101,10 @@ class PesterMemo(PesterConvo):
msgbox.setText("%s: Invites only!" % (c)) msgbox.setText("%s: Invites only!" % (c))
msgbox.setInformativeText("This channel is invite-only. You must get an invitation from someone on the inside before entering.") msgbox.setInformativeText("This channel is invite-only. You must get an invitation from someone on the inside before entering.")
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.exec_() msgbox.exec()
def quirkDisable(self, op, msg): def quirkDisable(self, op, msg):
chums = self.userlist.findItems(op, QtCore.Qt.MatchFlags(0)) chums = self.userlist.findItems(op, QtCore.Qt.MatchFlag.MatchExactly)
for c in chums: for c in chums:
if c.op: if c.op:
if msg == self.mainwindow.profile().handle: if msg == self.mainwindow.profile().handle:
@ -1190,7 +1190,7 @@ class PesterMemo(PesterConvo):
"+a", "-a", "+v", "-v"]) \ "+a", "-a", "+v", "-v"]) \
and c.lower() != self.channel.lower(): and c.lower() != self.channel.lower():
return return
chums = self.userlist.findItems(h, QtCore.Qt.MatchFlags(0)) chums = self.userlist.findItems(h, QtCore.Qt.MatchFlag.MatchExactly)
systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"]) systemColor = QtGui.QColor(self.mainwindow.theme["memos/systemMsgColor"])
# print exit # print exit
if update in ("quit", "left", "nick", "netsplit"): if update in ("quit", "left", "nick", "netsplit"):
@ -1217,7 +1217,7 @@ class PesterMemo(PesterConvo):
self.mainwindow.chatlog.log(self.channel, msg) self.mainwindow.chatlog.log(self.channel, msg)
if update == "nick": if update == "nick":
self.addUser(newnick) self.addUser(newnick)
newchums = self.userlist.findItems(newnick, QtCore.Qt.MatchFlags(0)) newchums = self.userlist.findItems(newnick, QtCore.Qt.MatchFlag.MatchExactly)
for nc in newchums: for nc in newchums:
for c in chums: for c in chums:
nc.founder = c.founder nc.founder = c.founder
@ -1292,7 +1292,7 @@ class PesterMemo(PesterConvo):
# already stealing focus # already stealing focus
b.setFocus() b.setFocus()
break break
ret = msgbox.exec_() ret = msgbox.exec()
if ret == QtWidgets.QMessageBox.Ok: if ret == QtWidgets.QMessageBox.Ok:
self.userlist.clear() self.userlist.clear()
self.time = TimeTracker(curtime) self.time = TimeTracker(curtime)

182
menus.py
View file

@ -1,7 +1,7 @@
import re import re
from os import remove from os import remove
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import ostools import ostools
import parsetools import parsetools
@ -48,32 +48,35 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
self.addItem(item, False) self.addItem(item, False)
self.changeCheckState() self.changeCheckState()
#self.setDragEnabled(True) #self.setDragEnabled(True)
#self.setDragDropMode(QtGui.QAbstractItemView.InternalMove) #self.setDragDropMode(QtGui.QAbstractItemView.DragDropMode.InternalMove)
self.setDropIndicatorShown(True) self.setDropIndicatorShown(True)
self.setSortingEnabled(False) self.setSortingEnabled(False)
self.setIndentation(15) self.setIndentation(15)
self.header().hide() self.header().hide()
def addItem(self, item, new=True): def addItem(self, item, new=True):
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable
| QtCore.Qt.ItemFlag.ItemIsDragEnabled
| QtCore.Qt.ItemFlag.ItemIsUserCheckable
| QtCore.Qt.ItemFlag.ItemIsEnabled)
if item.quirk.on: if item.quirk.on:
item.setCheckState(0, 2) item.setCheckState(0, QtCore.Qt.CheckState.Checked)
else: else:
item.setCheckState(0, 0) item.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
if new: if new:
curgroup = self.currentItem() curgroup = self.currentItem()
if curgroup: if curgroup:
if curgroup.parent(): curgroup = curgroup.parent() if curgroup.parent(): curgroup = curgroup.parent()
item.quirk.quirk["group"] = item.quirk.group = curgroup.text(0) item.quirk.quirk["group"] = item.quirk.group = curgroup.text(0)
found = self.findItems(item.quirk.group, QtCore.Qt.MatchExactly) found = self.findItems(item.quirk.group, QtCore.Qt.MatchFlag.MatchExactly)
if len(found) > 0: if len(found) > 0:
found[0].addChild(item) found[0].addChild(item)
else: else:
child_1 = QtWidgets.QTreeWidgetItem([item.quirk.group]) child_1 = QtWidgets.QTreeWidgetItem([item.quirk.group])
self.addTopLevelItem(child_1) self.addTopLevelItem(child_1)
child_1.setFlags(child_1.flags() | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) child_1.setFlags(child_1.flags() | QtCore.Qt.ItemFlag.ItemIsUserCheckable | QtCore.Qt.ItemFlag.ItemIsEnabled)
child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.DontShowIndicatorWhenChildless) child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicatorWhenChildless)
child_1.setCheckState(0,0) child_1.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
child_1.setExpanded(True) child_1.setExpanded(True)
child_1.addChild(item) child_1.addChild(item)
self.changeCheckState() self.changeCheckState()
@ -85,7 +88,7 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def upShiftQuirk(self): def upShiftQuirk(self):
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchExactly) found = self.findItems(self.currentItem().text(0), QtCore.MatchFlag.Qt.MatchExactly)
if len(found): # group if len(found): # group
i = self.indexOfTopLevelItem(found[0]) i = self.indexOfTopLevelItem(found[0])
if i > 0: if i > 0:
@ -95,7 +98,7 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
shifted_item.setExpanded(expand) shifted_item.setExpanded(expand)
self.setCurrentItem(shifted_item) self.setCurrentItem(shifted_item)
else: # quirk else: # quirk
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive) found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
for f in found: for f in found:
if not f.isSelected(): continue if not f.isSelected(): continue
if not f.parent(): continue if not f.parent(): continue
@ -115,7 +118,7 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def downShiftQuirk(self): def downShiftQuirk(self):
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchExactly) found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly)
if len(found): # group if len(found): # group
i = self.indexOfTopLevelItem(found[0]) i = self.indexOfTopLevelItem(found[0])
if i < self.topLevelItemCount()-1 and i >= 0: if i < self.topLevelItemCount()-1 and i >= 0:
@ -125,7 +128,7 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
shifted_item.setExpanded(expand) shifted_item.setExpanded(expand)
self.setCurrentItem(shifted_item) self.setCurrentItem(shifted_item)
else: # quirk else: # quirk
found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive) found = self.findItems(self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
for f in found: for f in found:
if not f.isSelected(): continue if not f.isSelected(): continue
if not f.parent(): continue if not f.parent(): continue
@ -146,7 +149,7 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def removeCurrent(self): def removeCurrent(self):
i = self.currentItem() i = self.currentItem()
found = self.findItems(i.text(0), QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive) found = self.findItems(i.text(0), QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
for f in found: for f in found:
if not f.isSelected(): continue if not f.isSelected(): continue
if not f.parent(): # group if not f.parent(): # group
@ -166,7 +169,7 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
# already stealing focus # already stealing focus
b.setFocus() b.setFocus()
break break
ret = msgbox.exec_() ret = msgbox.exec()
if ret == QtWidgets.QMessageBox.Ok: if ret == QtWidgets.QMessageBox.Ok:
self.takeTopLevelItem(self.indexOfTopLevelItem(f)) self.takeTopLevelItem(self.indexOfTopLevelItem(f))
else: else:
@ -185,21 +188,21 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME") msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.exec_() msgbox.exec()
self.addgroupdialog = None self.addgroupdialog = None
return return
found = self.findItems(gname, QtCore.Qt.MatchExactly) found = self.findItems(gname, QtCore.Qt.MatchFlag.MatchExactly)
if found: if found:
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
msgbox.setInformativeText("THIS QUIRK GROUP ALREADY EXISTS") msgbox.setInformativeText("THIS QUIRK GROUP ALREADY EXISTS")
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.exec_() msgbox.exec()
return return
child_1 = QtWidgets.QTreeWidgetItem([gname]) child_1 = QtWidgets.QTreeWidgetItem([gname])
self.addTopLevelItem(child_1) self.addTopLevelItem(child_1)
child_1.setFlags(child_1.flags() | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) child_1.setFlags(child_1.flags() | QtCore.Qt.ItemFlag.ItemIsUserCheckable | QtCore.Qt.ItemFlag.ItemIsEnabled)
child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.DontShowIndicatorWhenChildless) child_1.setChildIndicatorPolicy(QtWidgets.QTreeWidgetItem.ChildIndicatorPolicy.DontShowIndicatorWhenChildless)
child_1.setCheckState(0,0) child_1.setCheckState(0, QtCore.Qt.CheckState.Unchecked)
child_1.setExpanded(True) child_1.setExpanded(True)
self.addgroupdialog = None self.addgroupdialog = None
@ -216,9 +219,9 @@ class PesterQuirkList(QtWidgets.QTreeWidget):
noneChecked = False noneChecked = False
else: else:
allChecked = False allChecked = False
if allChecked: self.topLevelItem(i).setCheckState(0, 2) if allChecked: self.topLevelItem(i).setCheckState(0, QtCore.Qt.CheckState.Checked)
elif noneChecked: self.topLevelItem(i).setCheckState(0, 0) elif noneChecked: self.topLevelItem(i).setCheckState(0, QtCore.Qt.CheckState.PartiallyChecked)
else: self.topLevelItem(i).setCheckState(0, 1) else: self.topLevelItem(i).setCheckState(0, QtCore.Qt.CheckState.Checked)
else: else:
state = self.topLevelItem(index).checkState(0) state = self.topLevelItem(index).checkState(0)
for j in range(self.topLevelItem(index).childCount()): for j in range(self.topLevelItem(index).childCount()):
@ -293,18 +296,18 @@ class PesterQuirkTypes(QtWidgets.QDialog):
self.cancel = QtWidgets.QPushButton("Cancel", self) self.cancel = QtWidgets.QPushButton("Cancel", self)
self.cancel.clicked.connect(self.reject) self.cancel.clicked.connect(self.reject)
layout_2 = QtWidgets.QHBoxLayout() layout_2 = QtWidgets.QHBoxLayout()
layout_2.setAlignment(QtCore.Qt.AlignRight) layout_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
layout_2.addWidget(self.back) layout_2.addWidget(self.back)
layout_2.addWidget(self.next) layout_2.addWidget(self.next)
layout_2.addSpacing(5) layout_2.addSpacing(5)
layout_2.addWidget(self.cancel) layout_2.addWidget(self.cancel)
vr = QtWidgets.QFrame() vr = QtWidgets.QFrame()
vr.setFrameShape(QtWidgets.QFrame.VLine) vr.setFrameShape(QtWidgets.QFrame.Shape.VLine)
vr.setFrameShadow(QtWidgets.QFrame.Sunken) vr.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
vr2 = QtWidgets.QFrame() vr2 = QtWidgets.QFrame()
vr2.setFrameShape(QtWidgets.QFrame.VLine) vr2.setFrameShape(QtWidgets.QFrame.Shape.VLine)
vr2.setFrameShadow(QtWidgets.QFrame.Sunken) vr2.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.funclist = QtWidgets.QListWidget(self) self.funclist = QtWidgets.QListWidget(self)
self.funclist.setStyleSheet("color: #000000; background-color: #FFFFFF;") self.funclist.setStyleSheet("color: #000000; background-color: #FFFFFF;")
@ -340,7 +343,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_select = QtWidgets.QVBoxLayout(widget) layout_select = QtWidgets.QVBoxLayout(widget)
layout_select.setAlignment(QtCore.Qt.AlignTop) layout_select.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
self.radios = [] self.radios = []
self.radios.append(QtWidgets.QRadioButton("Prefix", self)) self.radios.append(QtWidgets.QRadioButton("Prefix", self))
self.radios.append(QtWidgets.QRadioButton("Suffix", self)) self.radios.append(QtWidgets.QRadioButton("Suffix", self))
@ -357,7 +360,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_prefix = QtWidgets.QVBoxLayout(widget) layout_prefix = QtWidgets.QVBoxLayout(widget)
layout_prefix.setAlignment(QtCore.Qt.AlignTop) layout_prefix.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_prefix.addWidget(QtWidgets.QLabel("Prefix")) layout_prefix.addWidget(QtWidgets.QLabel("Prefix"))
layout_3 = QtWidgets.QHBoxLayout() layout_3 = QtWidgets.QHBoxLayout()
layout_3.addWidget(QtWidgets.QLabel("Value:")) layout_3.addWidget(QtWidgets.QLabel("Value:"))
@ -368,7 +371,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_suffix = QtWidgets.QVBoxLayout(widget) layout_suffix = QtWidgets.QVBoxLayout(widget)
layout_suffix.setAlignment(QtCore.Qt.AlignTop) layout_suffix.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_suffix.addWidget(QtWidgets.QLabel("Suffix")) layout_suffix.addWidget(QtWidgets.QLabel("Suffix"))
layout_3 = QtWidgets.QHBoxLayout() layout_3 = QtWidgets.QHBoxLayout()
layout_3.addWidget(QtWidgets.QLabel("Value:")) layout_3.addWidget(QtWidgets.QLabel("Value:"))
@ -379,7 +382,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_replace = QtWidgets.QVBoxLayout(widget) layout_replace = QtWidgets.QVBoxLayout(widget)
layout_replace.setAlignment(QtCore.Qt.AlignTop) layout_replace.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_replace.addWidget(QtWidgets.QLabel("Simple Replace")) layout_replace.addWidget(QtWidgets.QLabel("Simple Replace"))
layout_3 = QtWidgets.QHBoxLayout() layout_3 = QtWidgets.QHBoxLayout()
layout_3.addWidget(QtWidgets.QLabel("Replace:")) layout_3.addWidget(QtWidgets.QLabel("Replace:"))
@ -401,7 +404,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_all = QtWidgets.QHBoxLayout(widget) layout_all = QtWidgets.QHBoxLayout(widget)
layout_regexp = QtWidgets.QVBoxLayout() layout_regexp = QtWidgets.QVBoxLayout()
layout_regexp.setAlignment(QtCore.Qt.AlignTop) layout_regexp.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_regexp.addWidget(QtWidgets.QLabel("Regexp Replace")) layout_regexp.addWidget(QtWidgets.QLabel("Regexp Replace"))
layout_3 = QtWidgets.QHBoxLayout() layout_3 = QtWidgets.QHBoxLayout()
layout_3.addWidget(QtWidgets.QLabel("Regexp:")) layout_3.addWidget(QtWidgets.QLabel("Regexp:"))
@ -427,7 +430,7 @@ class PesterQuirkTypes(QtWidgets.QDialog):
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_all = QtWidgets.QHBoxLayout(widget) layout_all = QtWidgets.QHBoxLayout(widget)
layout_random = QtWidgets.QVBoxLayout() layout_random = QtWidgets.QVBoxLayout()
layout_random.setAlignment(QtCore.Qt.AlignTop) layout_random.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_random.addWidget(QtWidgets.QLabel("Random Replace")) layout_random.addWidget(QtWidgets.QLabel("Random Replace"))
layout_5 = QtWidgets.QHBoxLayout() layout_5 = QtWidgets.QHBoxLayout()
regexpl = QtWidgets.QLabel("Regexp:", self) regexpl = QtWidgets.QLabel("Regexp:", self)
@ -467,14 +470,14 @@ class PesterQuirkTypes(QtWidgets.QDialog):
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
self.pages.addWidget(widget) self.pages.addWidget(widget)
layout_mispeller = QtWidgets.QVBoxLayout(widget) layout_mispeller = QtWidgets.QVBoxLayout(widget)
layout_mispeller.setAlignment(QtCore.Qt.AlignTop) layout_mispeller.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_mispeller.addWidget(QtWidgets.QLabel("Mispeller")) layout_mispeller.addWidget(QtWidgets.QLabel("Mispeller"))
layout_1 = QtWidgets.QHBoxLayout() layout_1 = QtWidgets.QHBoxLayout()
zero = QtWidgets.QLabel("1%", self) zero = QtWidgets.QLabel("1%", self)
hund = QtWidgets.QLabel("100%", self) hund = QtWidgets.QLabel("100%", self)
self.current = QtWidgets.QLabel("50%", self) self.current = QtWidgets.QLabel("50%", self)
self.current.setAlignment(QtCore.Qt.AlignHCenter) self.current.setAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.slider = QtWidgets.QSlider(QtCore.Qt.Orientation.Horizontal, self)
self.slider.setMinimum(1) self.slider.setMinimum(1)
self.slider.setMaximum(100) self.slider.setMaximum(100)
self.slider.setValue(50) self.slider.setValue(50)
@ -510,14 +513,14 @@ class PesterQuirkTypes(QtWidgets.QDialog):
page.itemAt(1).layout().itemAt(1).widget().setText(q["from"]) page.itemAt(1).layout().itemAt(1).widget().setText(q["from"])
page.itemAt(2).layout().itemAt(1).widget().setText(q["to"]) page.itemAt(2).layout().itemAt(1).widget().setText(q["to"])
try: try:
page.itemAt(3).layout().itemAt(0).widget().setCheckState(int(q["checkstate"])) page.itemAt(3).layout().itemAt(0).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
except (KeyError, ValueError) as e: except (KeyError, ValueError) as e:
print("KeyError: %s" % str(e)) print("KeyError: %s" % str(e))
elif q["type"] == "regexp": elif q["type"] == "regexp":
page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().setText(q["from"]) page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().setText(q["from"])
page.itemAt(2).layout().itemAt(2).layout().itemAt(1).widget().setText(q["to"]) page.itemAt(2).layout().itemAt(2).layout().itemAt(1).widget().setText(q["to"])
try: try:
page.itemAt(2).layout().itemAt(3).layout().itemAt(0).widget().setCheckState(int(q["checkstate"])) page.itemAt(2).layout().itemAt(3).layout().itemAt(0).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
except (KeyError, ValueError) as e: except (KeyError, ValueError) as e:
print("KeyError: %s" % str(e)) print("KeyError: %s" % str(e))
elif q["type"] == "random": elif q["type"] == "random":
@ -525,13 +528,13 @@ class PesterQuirkTypes(QtWidgets.QDialog):
for v in q["randomlist"]: for v in q["randomlist"]:
item = QtWidgets.QListWidgetItem(v, self.replacelist) item = QtWidgets.QListWidgetItem(v, self.replacelist)
try: try:
page.itemAt(2).layout().itemAt(2).layout().itemAt(0).widget().setCheckState(int(q["checkstate"])) page.itemAt(2).layout().itemAt(2).layout().itemAt(0).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
except (KeyError, ValueError) as e: except (KeyError, ValueError) as e:
print("KeyError: %s" % str(e)) print("KeyError: %s" % str(e))
elif q["type"] == "spelling": elif q["type"] == "spelling":
self.slider.setValue(q["percentage"]) self.slider.setValue(q["percentage"])
try: try:
page.itemAt(3).layout().itemAt(0).widget().setCheckState(int(q["checkstate"])) page.itemAt(3).layout().itemAt(0).widget().setCheckState(QtCore.Qt.CheckState(int(q["checkstate"])))
except (KeyError, ValueError) as e: except (KeyError, ValueError) as e:
print("KeyError: %s" % str(e)) print("KeyError: %s" % str(e))
@ -673,7 +676,7 @@ class PesterChooseQuirks(QtWidgets.QDialog):
for i in range(self.quirkList.topLevelItemCount()): for i in range(self.quirkList.topLevelItemCount()):
for j in range(self.quirkList.topLevelItem(i).childCount()): for j in range(self.quirkList.topLevelItem(i).childCount()):
item = self.quirkList.topLevelItem(i).child(j) item = self.quirkList.topLevelItem(i).child(j)
if (item.checkState(0) == QtCore.Qt.Checked): if (item.checkState(0) == QtCore.Qt.CheckState.Checked):
u.append(item.quirk) u.append(item.quirk)
return u return u
@ -714,20 +717,20 @@ class PesterChooseQuirks(QtWidgets.QDialog):
elif vdict["type"] == "replace": elif vdict["type"] == "replace":
vdict["from"] = str(page.itemAt(1).layout().itemAt(1).widget().text()) vdict["from"] = str(page.itemAt(1).layout().itemAt(1).widget().text())
vdict["to"] = str(page.itemAt(2).layout().itemAt(1).widget().text()) vdict["to"] = str(page.itemAt(2).layout().itemAt(1).widget().text())
vdict["checkstate"] = str(page.itemAt(3).layout().itemAt(0).widget().checkState()) vdict["checkstate"] = str(page.itemAt(3).layout().itemAt(0).widget().checkState().value)
elif vdict["type"] == "regexp": elif vdict["type"] == "regexp":
vdict["from"] = str(page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().text()) vdict["from"] = str(page.itemAt(2).layout().itemAt(1).layout().itemAt(1).widget().text())
vdict["to"] = str(page.itemAt(2).layout().itemAt(2).layout().itemAt(1).widget().text()) vdict["to"] = str(page.itemAt(2).layout().itemAt(2).layout().itemAt(1).widget().text())
vdict["checkstate"] = str(page.itemAt(2).layout().itemAt(3).layout().itemAt(0).widget().checkState()) vdict["checkstate"] = str(page.itemAt(2).layout().itemAt(3).layout().itemAt(0).widget().checkState().value)
elif vdict["type"] == "random": elif vdict["type"] == "random":
vdict["from"] = str(self.quirkadd.regexp.text()) vdict["from"] = str(self.quirkadd.regexp.text())
vdict["checkstate"] = str(page.itemAt(2).layout().itemAt(2).layout().itemAt(0).widget().checkState()) vdict["checkstate"] = str(page.itemAt(2).layout().itemAt(2).layout().itemAt(0).widget().checkState().value)
randomlist = [str(self.quirkadd.replacelist.item(i).text()) randomlist = [str(self.quirkadd.replacelist.item(i).text())
for i in range(0,self.quirkadd.replacelist.count())] for i in range(0,self.quirkadd.replacelist.count())]
vdict["randomlist"] = randomlist vdict["randomlist"] = randomlist
elif vdict["type"] == "spelling": elif vdict["type"] == "spelling":
vdict["percentage"] = self.quirkadd.slider.value() vdict["percentage"] = self.quirkadd.slider.value()
vdict["checkstate"] = str(page.itemAt(3).layout().itemAt(0).widget().checkState()) vdict["checkstate"] = str(page.itemAt(3).layout().itemAt(0).widget().checkState().value)
if vdict["type"] in ("regexp", "random"): if vdict["type"] in ("regexp", "random"):
try: try:
re.compile(vdict["from"]) re.compile(vdict["from"])
@ -735,7 +738,7 @@ class PesterChooseQuirks(QtWidgets.QDialog):
quirkWarning = QtWidgets.QMessageBox(self) quirkWarning = QtWidgets.QMessageBox(self)
quirkWarning.setText("Not a valid regular expression!") quirkWarning.setText("Not a valid regular expression!")
quirkWarning.setInformativeText("H3R3S WHY DUMP4SS: %s" % (e)) quirkWarning.setInformativeText("H3R3S WHY DUMP4SS: %s" % (e))
quirkWarning.exec_() quirkWarning.exec()
self.quirkadd = None self.quirkadd = None
return return
@ -846,7 +849,7 @@ class PesterChooseProfile(QtWidgets.QDialog):
collision_warning = QtWidgets.QLabel("%s is taken already! Pick a new profile." % (collision)) collision_warning = QtWidgets.QLabel("%s is taken already! Pick a new profile." % (collision))
layout_0.addWidget(collision_warning) layout_0.addWidget(collision_warning)
else: else:
layout_0.addWidget(self.currentHandle, alignment=QtCore.Qt.AlignHCenter) layout_0.addWidget(self.currentHandle, alignment=QtCore.Qt.AlignmentFlag.AlignHCenter)
layout_0.addLayout(layout_1) layout_0.addLayout(layout_1)
if avail_profiles: if avail_profiles:
profileLabel = QtWidgets.QLabel("Or choose an existing profile:", self) profileLabel = QtWidgets.QLabel("Or choose an existing profile:", self)
@ -897,7 +900,7 @@ class PesterChooseProfile(QtWidgets.QDialog):
problem.setWindowTitle("Problem!") problem.setWindowTitle("Problem!")
problem.setInformativeText("You can't delete the profile you're currently using!") problem.setInformativeText("You can't delete the profile you're currently using!")
problem.setStandardButtons(QtWidgets.QMessageBox.Ok) problem.setStandardButtons(QtWidgets.QMessageBox.Ok)
problem.exec_() problem.exec()
return return
# TODO: Make this select 'no' as the default, as usual. # TODO: Make this select 'no' as the default, as usual.
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
@ -905,7 +908,7 @@ class PesterChooseProfile(QtWidgets.QDialog):
msgbox.setWindowTitle("WARNING!") msgbox.setWindowTitle("WARNING!")
msgbox.setInformativeText("Are you sure you want to delete the profile: %s" % (handle)) msgbox.setInformativeText("Are you sure you want to delete the profile: %s" % (handle))
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
ret = msgbox.exec_() ret = msgbox.exec()
if ret == QtWidgets.QMessageBox.Ok: if ret == QtWidgets.QMessageBox.Ok:
try: try:
remove(_datadir+"profiles/%s.js" % (handle)) remove(_datadir+"profiles/%s.js" % (handle))
@ -916,7 +919,7 @@ class PesterChooseProfile(QtWidgets.QDialog):
problem.setWindowTitle("Problem!") problem.setWindowTitle("Problem!")
problem.setInformativeText("There was a problem deleting the profile: %s" % (handle)) problem.setInformativeText("There was a problem deleting the profile: %s" % (handle))
problem.setStandardButtons(QtWidgets.QMessageBox.Ok) problem.setStandardButtons(QtWidgets.QMessageBox.Ok)
problem.exec_() problem.exec()
class PesterMentions(QtWidgets.QDialog): class PesterMentions(QtWidgets.QDialog):
def __init__(self, window, theme, parent): def __init__(self, window, theme, parent):
@ -979,7 +982,7 @@ class PesterMentions(QtWidgets.QDialog):
quirkWarning = QtWidgets.QMessageBox(self) quirkWarning = QtWidgets.QMessageBox(self)
quirkWarning.setText("Not a valid regular expression!") quirkWarning.setText("Not a valid regular expression!")
quirkWarning.setInformativeText("H3R3S WHY DUMP4SS: %s" % (e)) quirkWarning.setInformativeText("H3R3S WHY DUMP4SS: %s" % (e))
quirkWarning.exec_() quirkWarning.exec()
else: else:
if mitem is None: if mitem is None:
self.mentionlist.addItem(pdict["value"]) self.mentionlist.addItem(pdict["value"])
@ -1004,17 +1007,17 @@ class PesterOptions(QtWidgets.QDialog):
layout_4 = QtWidgets.QVBoxLayout() layout_4 = QtWidgets.QVBoxLayout()
hr = QtWidgets.QFrame() hr = QtWidgets.QFrame()
hr.setFrameShape(QtWidgets.QFrame.HLine) hr.setFrameShape(QtWidgets.QFrame.Shape.HLine)
hr.setFrameShadow(QtWidgets.QFrame.Sunken) hr.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
vr = QtWidgets.QFrame() vr = QtWidgets.QFrame()
vr.setFrameShape(QtWidgets.QFrame.VLine) vr.setFrameShape(QtWidgets.QFrame.Shape.VLine)
vr.setFrameShadow(QtWidgets.QFrame.Sunken) vr.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.tabs = QtWidgets.QButtonGroup(self) self.tabs = QtWidgets.QButtonGroup(self)
self.tabs.buttonClicked[int].connect(self.changePage) self.tabs.buttonClicked.connect(self.changePage) # Verify working
tabNames = ["Chum List", "Conversations", "Interface", "Sound", "Notifications", "Logging", "Idle/Updates", "Theme", "Connection"] self.tabNames = ["Chum List", "Conversations", "Interface", "Sound", "Notifications", "Logging", "Idle/Updates", "Theme", "Connection"]
if parent.advanced: tabNames.append("Advanced") if parent.advanced: self.tabNames.append("Advanced")
for t in tabNames: for t in self.tabNames:
button = QtWidgets.QPushButton(t) button = QtWidgets.QPushButton(t)
self.tabs.addButton(button) self.tabs.addButton(button)
layout_4.addWidget(button) layout_4.addWidget(button)
@ -1036,7 +1039,7 @@ class PesterOptions(QtWidgets.QDialog):
self.autonickserv.stateChanged[int].connect(self.autoNickServChange) self.autonickserv.stateChanged[int].connect(self.autoNickServChange)
self.nickservpass = QtWidgets.QLineEdit(self) self.nickservpass = QtWidgets.QLineEdit(self)
self.nickservpass.setPlaceholderText("NickServ Password") self.nickservpass.setPlaceholderText("NickServ Password")
self.nickservpass.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit) self.nickservpass.setEchoMode(QtWidgets.QLineEdit.EchoMode.PasswordEchoOnEdit)
self.nickservpass.setText(parent.userprofile.getNickServPass()) self.nickservpass.setText(parent.userprofile.getNickServPass())
self.autojoinlist = QtWidgets.QListWidget(self) self.autojoinlist = QtWidgets.QListWidget(self)
@ -1081,7 +1084,7 @@ class PesterOptions(QtWidgets.QDialog):
self.editMentions2 = QtWidgets.QPushButton("Edit Mentions", self) self.editMentions2 = QtWidgets.QPushButton("Edit Mentions", self)
self.editMentions2.clicked.connect(self.openMentions) self.editMentions2.clicked.connect(self.openMentions)
self.volume = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.volume = QtWidgets.QSlider(QtCore.Qt.Orientation.Horizontal, self)
self.volume.setMinimum(0) self.volume.setMinimum(0)
self.volume.setMaximum(100) self.volume.setMaximum(100)
self.volume.setValue(self.config.volume()) self.volume.setValue(self.config.volume())
@ -1098,7 +1101,7 @@ class PesterOptions(QtWidgets.QDialog):
self.currentVol = QtWidgets.QLabel( self.currentVol = QtWidgets.QLabel(
"(Disabled: Sound Mixer Error)", self) "(Disabled: Sound Mixer Error)", self)
self.volume.setEnabled(False) self.volume.setEnabled(False)
self.currentVol.setAlignment(QtCore.Qt.AlignHCenter) self.currentVol.setAlignment(QtCore.Qt.AlignmentFlag.AlignHCenter)
self.timestampcheck = QtWidgets.QCheckBox("Time Stamps", self) self.timestampcheck = QtWidgets.QCheckBox("Time Stamps", self)
@ -1282,7 +1285,7 @@ class PesterOptions(QtWidgets.QDialog):
# Chum List # Chum List
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_chumlist = QtWidgets.QVBoxLayout(widget) layout_chumlist = QtWidgets.QVBoxLayout(widget)
layout_chumlist.setAlignment(QtCore.Qt.AlignTop) layout_chumlist.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_chumlist.addWidget(self.hideOffline) layout_chumlist.addWidget(self.hideOffline)
#layout_chumlist.addWidget(self.groupscheck) #layout_chumlist.addWidget(self.groupscheck)
layout_chumlist.addWidget(self.showemptycheck) layout_chumlist.addWidget(self.showemptycheck)
@ -1293,7 +1296,7 @@ class PesterOptions(QtWidgets.QDialog):
# Conversations # Conversations
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_chat = QtWidgets.QVBoxLayout(widget) layout_chat = QtWidgets.QVBoxLayout(widget)
layout_chat.setAlignment(QtCore.Qt.AlignTop) layout_chat.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_chat.addWidget(self.timestampcheck) layout_chat.addWidget(self.timestampcheck)
layout_chat.addWidget(self.timestampBox) layout_chat.addWidget(self.timestampBox)
layout_chat.addWidget(self.secondscheck) layout_chat.addWidget(self.secondscheck)
@ -1311,7 +1314,7 @@ class PesterOptions(QtWidgets.QDialog):
# Interface # Interface
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_interface = QtWidgets.QVBoxLayout(widget) layout_interface = QtWidgets.QVBoxLayout(widget)
layout_interface.setAlignment(QtCore.Qt.AlignTop) layout_interface.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_interface.addWidget(self.tabcheck) layout_interface.addWidget(self.tabcheck)
layout_interface.addWidget(self.tabmemocheck) layout_interface.addWidget(self.tabmemocheck)
layout_interface.addLayout(layout_mini) layout_interface.addLayout(layout_mini)
@ -1323,7 +1326,7 @@ class PesterOptions(QtWidgets.QDialog):
# Sound # Sound
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_sound = QtWidgets.QVBoxLayout(widget) layout_sound = QtWidgets.QVBoxLayout(widget)
layout_sound.setAlignment(QtCore.Qt.AlignTop) layout_sound.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_sound.addWidget(self.soundcheck) layout_sound.addWidget(self.soundcheck)
layout_indent = QtWidgets.QVBoxLayout() layout_indent = QtWidgets.QVBoxLayout()
layout_indent.addWidget(self.chatsoundcheck) layout_indent.addWidget(self.chatsoundcheck)
@ -1351,7 +1354,7 @@ class PesterOptions(QtWidgets.QDialog):
# Notifications # Notifications
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_notify = QtWidgets.QVBoxLayout(widget) layout_notify = QtWidgets.QVBoxLayout(widget)
layout_notify.setAlignment(QtCore.Qt.AlignTop) layout_notify.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_notify.addWidget(self.notifycheck) layout_notify.addWidget(self.notifycheck)
layout_indent = QtWidgets.QVBoxLayout() layout_indent = QtWidgets.QVBoxLayout()
layout_indent.addLayout(layout_type) layout_indent.addLayout(layout_type)
@ -1371,7 +1374,7 @@ class PesterOptions(QtWidgets.QDialog):
# Logging # Logging
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_logs = QtWidgets.QVBoxLayout(widget) layout_logs = QtWidgets.QVBoxLayout(widget)
layout_logs.setAlignment(QtCore.Qt.AlignTop) layout_logs.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_logs.addWidget(self.logpesterscheck) layout_logs.addWidget(self.logpesterscheck)
layout_logs.addWidget(self.logmemoscheck) layout_logs.addWidget(self.logmemoscheck)
layout_logs.addWidget(self.stamppestercheck) layout_logs.addWidget(self.stamppestercheck)
@ -1381,7 +1384,7 @@ class PesterOptions(QtWidgets.QDialog):
# Idle/Updates # Idle/Updates
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_idle = QtWidgets.QVBoxLayout(widget) layout_idle = QtWidgets.QVBoxLayout(widget)
layout_idle.setAlignment(QtCore.Qt.AlignTop) layout_idle.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_idle.addLayout(layout_5) layout_idle.addLayout(layout_5)
layout_idle.addLayout(layout_6) layout_idle.addLayout(layout_6)
#if not ostools.isOSXLeopard(): #if not ostools.isOSXLeopard():
@ -1391,7 +1394,7 @@ class PesterOptions(QtWidgets.QDialog):
# Theme # Theme
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_theme = QtWidgets.QVBoxLayout(widget) layout_theme = QtWidgets.QVBoxLayout(widget)
layout_theme.setAlignment(QtCore.Qt.AlignTop) layout_theme.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_theme.addWidget(QtWidgets.QLabel("Pick a Theme:")) layout_theme.addWidget(QtWidgets.QLabel("Pick a Theme:"))
layout_theme.addWidget(self.themeBox) layout_theme.addWidget(self.themeBox)
layout_theme.addWidget(self.refreshtheme) layout_theme.addWidget(self.refreshtheme)
@ -1401,7 +1404,7 @@ class PesterOptions(QtWidgets.QDialog):
# Connection # Connection
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_connect = QtWidgets.QVBoxLayout(widget) layout_connect = QtWidgets.QVBoxLayout(widget)
layout_connect.setAlignment(QtCore.Qt.AlignTop) layout_connect.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_connect.addWidget(self.bandwidthcheck) layout_connect.addWidget(self.bandwidthcheck)
layout_connect.addWidget(bandwidthLabel) layout_connect.addWidget(bandwidthLabel)
layout_connect.addWidget(self.autonickserv) layout_connect.addWidget(self.autonickserv)
@ -1421,7 +1424,7 @@ class PesterOptions(QtWidgets.QDialog):
if parent.advanced: if parent.advanced:
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
layout_advanced = QtWidgets.QVBoxLayout(widget) layout_advanced = QtWidgets.QVBoxLayout(widget)
layout_advanced.setAlignment(QtCore.Qt.AlignTop) layout_advanced.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_advanced.addWidget(QtWidgets.QLabel("Current User Mode: %s" % parent.modes)) layout_advanced.addWidget(QtWidgets.QLabel("Current User Mode: %s" % parent.modes))
layout_advanced.addLayout(layout_change) layout_advanced.addLayout(layout_change)
self.pages.addWidget(widget) self.pages.addWidget(widget)
@ -1437,12 +1440,9 @@ class PesterOptions(QtWidgets.QDialog):
self.setLayout(layout_0) self.setLayout(layout_0)
@QtCore.pyqtSlot(int) @QtCore.pyqtSlot(QtWidgets.QAbstractButton)
def changePage(self, page): def changePage(self, button):
self.tabs.button(page).setChecked(True) self.pages.setCurrentIndex(self.tabNames.index(button.text()))
# What is this, I don't even. qt, fuck
page = -page - 2
self.pages.setCurrentIndex(page)
@QtCore.pyqtSlot(int) @QtCore.pyqtSlot(int)
def notifyChange(self, state): def notifyChange(self, state):
@ -1477,7 +1477,7 @@ class PesterOptions(QtWidgets.QDialog):
return return
pdict["value"] = "#" + pdict["value"] pdict["value"] = "#" + pdict["value"]
if mitem is None: if mitem is None:
items = self.autojoinlist.findItems(pdict["value"], QtCore.Qt.MatchFixedString) items = self.autojoinlist.findItems(pdict["value"], QtCore.Qt.MatchFlag.MatchFixedString)
if len(items) == 0: if len(items) == 0:
self.autojoinlist.addItem(pdict["value"]) self.autojoinlist.addItem(pdict["value"])
else: else:
@ -1555,9 +1555,9 @@ class PesterUserlist(QtWidgets.QDialog):
self.userarea.setStyleSheet(self.theme["main/chums/style"]) self.userarea.setStyleSheet(self.theme["main/chums/style"])
self.userarea.optionsMenu = QtWidgets.QMenu(self) self.userarea.optionsMenu = QtWidgets.QMenu(self)
self.addChumAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self) self.addChumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/addchum"], self)
self.addChumAction.triggered.connect(self.addChumSlot) self.addChumAction.triggered.connect(self.addChumSlot)
self.pesterChumAction = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self) self.pesterChumAction = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self)
self.pesterChumAction.triggered.connect(self.pesterChumSlot) self.pesterChumAction.triggered.connect(self.pesterChumSlot)
self.userarea.optionsMenu.addAction(self.addChumAction) self.userarea.optionsMenu.addAction(self.addChumAction)
self.userarea.optionsMenu.addAction(self.pesterChumAction) self.userarea.optionsMenu.addAction(self.pesterChumAction)
@ -1586,6 +1586,8 @@ class PesterUserlist(QtWidgets.QDialog):
self.userarea.clear() self.userarea.clear()
for n in names: for n in names:
if str(self.searchbox.text()) == "" or n.lower().find(str(self.searchbox.text()).lower()) != -1: if str(self.searchbox.text()) == "" or n.lower().find(str(self.searchbox.text()).lower()) != -1:
# Strip channel membership prefixes
n = n.strip('~').strip('@').strip('+').strip('&').strip('%')
item = QtWidgets.QListWidgetItem(n) item = QtWidgets.QListWidgetItem(n)
item.setForeground(QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"]))) item.setForeground(QtGui.QBrush(QtGui.QColor(self.theme["main/chums/userlistcolor"])))
self.userarea.addItem(item) self.userarea.addItem(item)
@ -1607,7 +1609,7 @@ class PesterUserlist(QtWidgets.QDialog):
self.userarea.addItem(item) self.userarea.addItem(item)
self.userarea.sortItems() self.userarea.sortItems()
def delUser(self, name): def delUser(self, name):
matches = self.userarea.findItems(name, QtCore.Qt.MatchFlags(0)) matches = self.userarea.findItems(name, QtCore.Qt.MatchFlag.MatchExactly)
for m in matches: for m in matches:
self.userarea.takeItem(self.userarea.row(m)) self.userarea.takeItem(self.userarea.row(m))
@ -1657,7 +1659,7 @@ class PesterMemoList(QtWidgets.QDialog):
self.label = QtWidgets.QLabel("MEMOS") self.label = QtWidgets.QLabel("MEMOS")
self.channelarea = RightClickTree(self) self.channelarea = RightClickTree(self)
self.channelarea.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.channelarea.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
self.channelarea.setStyleSheet(self.theme["main/chums/style"]) self.channelarea.setStyleSheet(self.theme["main/chums/style"])
self.channelarea.optionsMenu = QtWidgets.QMenu(self) self.channelarea.optionsMenu = QtWidgets.QMenu(self)
self.channelarea.setColumnCount(2) self.channelarea.setColumnCount(2)
@ -1666,7 +1668,7 @@ class PesterMemoList(QtWidgets.QDialog):
self.channelarea.setColumnWidth(0,200) self.channelarea.setColumnWidth(0,200)
self.channelarea.setColumnWidth(1,10) self.channelarea.setColumnWidth(1,10)
self.channelarea.setSortingEnabled(True) self.channelarea.setSortingEnabled(True)
self.channelarea.sortByColumn(0, QtCore.Qt.AscendingOrder) self.channelarea.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
self.channelarea.itemDoubleClicked[QtWidgets.QTreeWidgetItem, int].connect(self.AcceptSelection) self.channelarea.itemDoubleClicked[QtWidgets.QTreeWidgetItem, int].connect(self.AcceptSelection)
self.orjoinlabel = QtWidgets.QLabel("OR MAKE A NEW MEMO:") self.orjoinlabel = QtWidgets.QLabel("OR MAKE A NEW MEMO:")
@ -1675,7 +1677,7 @@ class PesterMemoList(QtWidgets.QDialog):
self.inviteChannel = QtWidgets.QCheckBox("INVITATION ONLY?", self) self.inviteChannel = QtWidgets.QCheckBox("INVITATION ONLY?", self)
self.timelabel = QtWidgets.QLabel("TIMEFRAME:") self.timelabel = QtWidgets.QLabel("TIMEFRAME:")
self.timeslider = TimeSlider(QtCore.Qt.Horizontal, self) self.timeslider = TimeSlider(QtCore.Qt.Orientation.Horizontal, self)
self.timeinput = TimeInput(self.timeslider, self) self.timeinput = TimeInput(self.timeslider, self)
self.cancel = QtWidgets.QPushButton("CANCEL", self) self.cancel = QtWidgets.QPushButton("CANCEL", self)
@ -1689,7 +1691,7 @@ class PesterMemoList(QtWidgets.QDialog):
layout_left = QtWidgets.QVBoxLayout() layout_left = QtWidgets.QVBoxLayout()
layout_right = QtWidgets.QVBoxLayout() layout_right = QtWidgets.QVBoxLayout()
layout_right.setAlignment(QtCore.Qt.AlignTop) layout_right.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
layout_0 = QtWidgets.QVBoxLayout() layout_0 = QtWidgets.QVBoxLayout()
layout_1 = QtWidgets.QHBoxLayout() layout_1 = QtWidgets.QHBoxLayout()
layout_left.addWidget(self.label) layout_left.addWidget(self.label)
@ -1746,8 +1748,8 @@ class LoadingScreen(QtWidgets.QDialog):
tryAgain = QtCore.pyqtSignal() tryAgain = QtCore.pyqtSignal()
def __init__(self, parent=None): def __init__(self, parent=None):
QtWidgets.QDialog.__init__(self, parent, (QtCore.Qt.CustomizeWindowHint | QtWidgets.QDialog.__init__(self, parent, (QtCore.Qt.WindowType.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint)) QtCore.Qt.WindowType.FramelessWindowHint))
self.mainwindow = parent self.mainwindow = parent
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"]) self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])

View file

@ -1,4 +1,4 @@
from PyQt5 import QtCore, QtWidgets from PyQt6 import QtCore, QtWidgets
from generic import PesterIcon from generic import PesterIcon

View file

@ -2,7 +2,7 @@ import os
import sys import sys
import platform import platform
from PyQt5.QtCore import QStandardPaths from PyQt6.QtCore import QStandardPaths
def isOSX(): def isOSX():
return sys.platform == "darwin" return sys.platform == "darwin"
@ -34,10 +34,10 @@ def getDataDir():
# in the Pesterchum install directory (like before) # in the Pesterchum install directory (like before)
try: try:
if isOSX(): if isOSX():
return os.path.join(str(QStandardPaths.writableLocation(QStandardPaths.DataLocation)), "Pesterchum/") return os.path.join(QStandardPaths.writableLocation(QStandardPaths.StandardLocation.DataLocation), "Pesterchum/")
elif isLinux(): elif isLinux():
return os.path.join(str(QStandardPaths.writableLocation(QStandardPaths.HomeLocation)), ".pesterchum/") return os.path.join(QStandardPaths.writableLocation(QStandardPaths.StandardLocation.HomeLocation), ".pesterchum/")
else: else:
return os.path.join(str(QStandardPaths.writableLocation(QStandardPaths.DataLocation)), "pesterchum/") return os.path.join(QStandardPaths.writableLocation(QStandardPaths.StandardLocation.DataLocation), "pesterchum/")
except UnicodeDecodeError: except UnicodeDecodeError:
return '' return ''

View file

@ -5,7 +5,7 @@ import collections
from copy import copy from copy import copy
from datetime import timedelta from datetime import timedelta
from PyQt5 import QtGui, QtWidgets from PyQt6 import QtGui, QtWidgets
import dataobjs import dataobjs
import ostools import ostools
@ -701,7 +701,7 @@ def kxhandleInput(ctx, text=None, flavor=None):
err_info = "A quirk seems to be having a problem. (Error: {!s})" err_info = "A quirk seems to be having a problem. (Error: {!s})"
err_info = err_info.format(err) err_info = err_info.format(err)
msgbox.setInformativeText(err_info) msgbox.setInformativeText(err_info)
msgbox.exec_() msgbox.exec()
return return
# Debug output. # Debug output.

View file

@ -41,7 +41,7 @@ from pnc.dep.attrdict import AttrDict
reqmissing = [] reqmissing = []
optmissing = [] optmissing = []
try: try:
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
except ImportError as e: except ImportError as e:
module = str(e) module = str(e)
if module.startswith("No module named ") or \ if module.startswith("No module named ") or \
@ -393,23 +393,23 @@ class chumArea(RightClickTree):
self.groupMenu = QtWidgets.QMenu(self) self.groupMenu = QtWidgets.QMenu(self)
self.canonMenu = QtWidgets.QMenu(self) self.canonMenu = QtWidgets.QMenu(self)
self.optionsMenu = QtWidgets.QMenu(self) self.optionsMenu = QtWidgets.QMenu(self)
self.pester = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self) self.pester = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/pester"], self)
self.pester.triggered.connect(self.activateChum) self.pester.triggered.connect(self.activateChum)
self.removechum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/removechum"], self) self.removechum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/removechum"], self)
self.removechum.triggered.connect(self.removeChum) self.removechum.triggered.connect(self.removeChum)
self.blockchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/blockchum"], self) self.blockchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/blockchum"], self)
self.blockchum.triggered.connect(self.blockChum) self.blockchum.triggered.connect(self.blockChum)
self.logchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self) self.logchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/viewlog"], self)
self.logchum.triggered.connect(self.openChumLogs) self.logchum.triggered.connect(self.openChumLogs)
self.reportchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self) self.reportchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/report"], self)
self.reportchum.triggered.connect(self.reportChum) self.reportchum.triggered.connect(self.reportChum)
self.findalts = QtWidgets.QAction("Find Alts", self) self.findalts = QtGui.QAction("Find Alts", self)
self.findalts.triggered.connect(self.findAlts) self.findalts.triggered.connect(self.findAlts)
self.removegroup = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/removegroup"], self) self.removegroup = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/removegroup"], self)
self.removegroup.triggered.connect(self.removeGroup) self.removegroup.triggered.connect(self.removeGroup)
self.renamegroup = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/renamegroup"], self) self.renamegroup = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/renamegroup"], self)
self.renamegroup.triggered.connect(self.renameGroup) self.renamegroup.triggered.connect(self.renameGroup)
self.notes = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/notes"], self) self.notes = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/notes"], self)
self.notes.triggered.connect(self.editNotes) self.notes.triggered.connect(self.editNotes)
self.optionsMenu.addAction(self.pester) self.optionsMenu.addAction(self.pester)
@ -435,13 +435,13 @@ class chumArea(RightClickTree):
self.initTheme(theme) self.initTheme(theme)
#self.sortItems() #self.sortItems()
#self.sortItems(1, QtCore.Qt.AscendingOrder) #self.sortItems(1, QtCore.Qt.SortOrder.AscendingOrder)
self.setSortingEnabled(False) self.setSortingEnabled(False)
self.header().hide() self.header().hide()
self.setDropIndicatorShown(True) self.setDropIndicatorShown(True)
self.setIndentation(4) self.setIndentation(4)
self.setDragEnabled(True) self.setDragEnabled(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove) self.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.InternalMove)
self.setAnimated(True) self.setAnimated(True)
self.setRootIsDecorated(False) self.setRootIsDecorated(False)
@ -482,13 +482,13 @@ class chumArea(RightClickTree):
# start drag # start drag
drag = QtGui.QDrag(self) drag = QtGui.QDrag(self)
drag.setMimeData(mime) drag.setMimeData(mime)
drag.exec_(QtCore.Qt.MoveAction) drag.exec(QtCore.Qt.DropAction.MoveAction)
except: except:
logging.exception('') logging.exception('')
def dragMoveEvent(self, event): def dragMoveEvent(self, event):
if event.mimeData().hasFormat("application/x-item"): if event.mimeData().hasFormat("application/x-item"):
event.setDropAction(QtCore.Qt.MoveAction) event.setDropAction(QtCore.Qt.DropAction.MoveAction)
event.accept() event.accept()
else: else:
event.ignore() event.ignore()
@ -587,7 +587,7 @@ class chumArea(RightClickTree):
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
currentGroup = text currentGroup = text
self.moveMenu.clear() self.moveMenu.clear()
actGroup = QtWidgets.QActionGroup(self) actGroup = QtGui.QActionGroup(self)
groups = self.groups[:] groups = self.groups[:]
for gtext in groups: for gtext in groups:
@ -595,7 +595,7 @@ class chumArea(RightClickTree):
continue continue
movegroup = self.moveMenu.addAction(gtext) movegroup = self.moveMenu.addAction(gtext)
actGroup.addAction(movegroup) actGroup.addAction(movegroup)
actGroup.triggered[QtWidgets.QAction].connect(self.moveToGroup) actGroup.triggered[QtGui.QAction].connect(self.moveToGroup)
def addChum(self, chum): def addChum(self, chum):
if len([c for c in self.chums if c.handle == chum.handle]) != 0: if len([c for c in self.chums if c.handle == chum.handle]) != 0:
@ -606,16 +606,16 @@ class chumArea(RightClickTree):
chumLabel = chumListing(chum, self.mainwindow) chumLabel = chumListing(chum, self.mainwindow)
self.addItem(chumLabel) self.addItem(chumLabel)
#self.topLevelItem(0).addChild(chumLabel) #self.topLevelItem(0).addChild(chumLabel)
#self.topLevelItem(0).sortChildren(0, QtCore.Qt.AscendingOrder) #self.topLevelItem(0).sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
def getChums(self, handle): def getChums(self, handle):
chums = self.findItems(handle, QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive) chums = self.findItems(handle, QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)
return chums return chums
def showAllChums(self): def showAllChums(self):
for c in self.chums: for c in self.chums:
chandle = c.handle chandle = c.handle
if not len(self.findItems(chandle, QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive)): if not len(self.findItems(chandle, QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive)):
#if True:# For if it doesn't work at all :/ #if True:# For if it doesn't work at all :/
chumLabel = chumListing(c, self.mainwindow) chumLabel = chumListing(c, self.mainwindow)
self.addItem(chumLabel) self.addItem(chumLabel)
@ -724,7 +724,7 @@ class chumArea(RightClickTree):
if text.rfind(" (") != -1: if text.rfind(" (") != -1:
text = text[0:text.rfind(" (")] text = text[0:text.rfind(" (")]
curgroups.append(text) curgroups.append(text)
if not self.findItems(chumLabel.handle, QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive): if not self.findItems(chumLabel.handle, QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive):
#if True:# For if it doesn't work at all :/ #if True:# For if it doesn't work at all :/
if chumLabel.chum.group not in curgroups: if chumLabel.chum.group not in curgroups:
child_1 = QtWidgets.QTreeWidgetItem(["%s" % (chumLabel.chum.group)]) child_1 = QtWidgets.QTreeWidgetItem(["%s" % (chumLabel.chum.group)])
@ -777,10 +777,10 @@ class chumArea(RightClickTree):
if self.mainwindow.config.showOnlineNumbers(): if self.mainwindow.config.showOnlineNumbers():
self.showOnlineNumbers() self.showOnlineNumbers()
else: # usually means this is now the trollslum else: # usually means this is now the trollslum
if not self.findItems(chumLabel.handle, QtCore.Qt.MatchExactly | QtCore.Qt.MatchRecursive): if not self.findItems(chumLabel.handle, QtCore.Qt.MatchFlag.MatchExactly | QtCore.Qt.MatchFlag.MatchRecursive):
#if True:# For if it doesn't work at all :/ #if True:# For if it doesn't work at all :/
self.topLevelItem(0).addChild(chumLabel) self.topLevelItem(0).addChild(chumLabel)
self.topLevelItem(0).sortChildren(0, QtCore.Qt.AscendingOrder) self.topLevelItem(0).sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
def takeItem(self, chumLabel): def takeItem(self, chumLabel):
r = None r = None
if not hasattr(chumLabel, 'chum'): if not hasattr(chumLabel, 'chum'):
@ -827,7 +827,7 @@ class chumArea(RightClickTree):
self.showOnlineNumbers() self.showOnlineNumbers()
return oldmood return oldmood
def updateColor(self, handle, color): def updateColor(self, handle, color):
chums = self.findItems(handle, QtCore.Qt.MatchFlags(0)) chums = self.findItems(handle, QtCore.Qt.MatchFlag.MatchExactly)
for c in chums: for c in chums:
c.setColor(color) c.setColor(color)
def initTheme(self, theme): def initTheme(self, theme):
@ -883,7 +883,7 @@ class chumArea(RightClickTree):
self.moodSort(i) self.moodSort(i)
else: else:
for i in range(self.topLevelItemCount()): for i in range(self.topLevelItemCount()):
self.topLevelItem(i).sortChildren(0, QtCore.Qt.AscendingOrder) self.topLevelItem(i).sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
def moodSort(self, group): def moodSort(self, group):
scrollPos = self.verticalScrollBar().sliderPosition() scrollPos = self.verticalScrollBar().sliderPosition()
chums = [] chums = []
@ -969,7 +969,7 @@ class chumArea(RightClickTree):
msgbox.setStyleSheet("QMessageBox{" + self.mainwindow.theme["main/defaultwindow/style"] + "}") msgbox.setStyleSheet("QMessageBox{" + self.mainwindow.theme["main/defaultwindow/style"] + "}")
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME") msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.exec_() msgbox.exec()
self.addgroupdialog = None self.addgroupdialog = None
return return
currentGroup = self.currentItem() currentGroup = self.currentItem()
@ -1017,7 +1017,7 @@ class chumArea(RightClickTree):
self.takeItem(chumLabel) self.takeItem(chumLabel)
self.addItem(chumLabel) self.addItem(chumLabel)
self.takeTopLevelItem(i) self.takeTopLevelItem(i)
@QtCore.pyqtSlot(QtWidgets.QAction) @QtCore.pyqtSlot(QtGui.QAction)
def moveToGroup(self, item): def moveToGroup(self, item):
if not item: if not item:
return return
@ -1049,7 +1049,7 @@ class trollSlum(chumArea):
child_1.setExpanded(True) child_1.setExpanded(True)
for c in self.chums: for c in self.chums:
chandle = c.handle chandle = c.handle
if not self.findItems(chandle, QtCore.Qt.MatchFlags(0)): if not self.findItems(chandle, QtCore.Qt.MatchFlag.MatchExactly):
chumLabel = chumListing(c, self.mainwindow) chumLabel = chumListing(c, self.mainwindow)
self.addItem(chumLabel) self.addItem(chumLabel)
@ -1059,14 +1059,14 @@ class trollSlum(chumArea):
self.setIndentation(0) self.setIndentation(0)
self.optionsMenu = QtWidgets.QMenu(self) self.optionsMenu = QtWidgets.QMenu(self)
self.unblockchum = QtWidgets.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self) self.unblockchum = QtGui.QAction(self.mainwindow.theme["main/menus/rclickchumlist/unblockchum"], self)
self.unblockchum.triggered.connect(self.unblockChumSignal) self.unblockchum.triggered.connect(self.unblockChumSignal)
self.optionsMenu.addAction(self.unblockchum) self.optionsMenu.addAction(self.unblockchum)
#self.sortItems() #self.sortItems()
def contextMenuEvent(self, event): def contextMenuEvent(self, event):
#fuckin Qt #fuckin Qt
if event.reason() == QtGui.QContextMenuEvent.Mouse: if event.reason() == QtGui.QContextMenuEvent.Reason.Mouse:
listing = self.itemAt(event.pos()) listing = self.itemAt(event.pos())
self.setCurrentItem(listing) self.setCurrentItem(listing)
if self.currentItem().text(0) != "": if self.currentItem().text(0) != "":
@ -1166,8 +1166,8 @@ class PesterWindow(MovingWindow):
def __init__(self, options, parent=None, app=None): def __init__(self, options, parent=None, app=None):
super(PesterWindow, self).__init__(None, super(PesterWindow, self).__init__(None,
(QtCore.Qt.CustomizeWindowHint | (QtCore.Qt.WindowType.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint)) QtCore.Qt.WindowType.FramelessWindowHint))
# For debugging # For debugging
_CONSOLE_ENV.PAPP = self _CONSOLE_ENV.PAPP = self
@ -1210,7 +1210,7 @@ class PesterWindow(MovingWindow):
msgBox = QtWidgets.QMessageBox() msgBox = QtWidgets.QMessageBox()
msgBox.setIcon(QtWidgets.QMessageBox.Information) msgBox.setIcon(QtWidgets.QMessageBox.Information)
msgBox.setWindowTitle(":(") msgBox.setWindowTitle(":(")
msgBox.setTextFormat(QtCore.Qt.RichText) # Clickable html links msgBox.setTextFormat(QtCore.Qt.TextFormat.RichText) # Clickable html links
self.filename = _datadir+"pesterchum.js" self.filename = _datadir+"pesterchum.js"
msgBox.setText("<html><h3>A profile error occured, trying to switch to default pesterClient profile." + \ msgBox.setText("<html><h3>A profile error occured, trying to switch to default pesterClient profile." + \
"<br><br>" + str(e) + "<\h3><\html>") "<br><br>" + str(e) + "<\h3><\html>")
@ -1218,7 +1218,7 @@ class PesterWindow(MovingWindow):
#_datadir+"pesterchum.js" + \ #_datadir+"pesterchum.js" + \
#"\"") #"\"")
PchumLog.critical(e) PchumLog.critical(e)
msgBox.exec_() msgBox.exec()
self.userprofile = userProfile(PesterProfile("pesterClient%d" % (random.randint(100,999)), QtGui.QColor("black"), Mood(0))) self.userprofile = userProfile(PesterProfile("pesterClient%d" % (random.randint(100,999)), QtGui.QColor("black"), Mood(0)))
self.theme = self.userprofile.getTheme() self.theme = self.userprofile.getTheme()
@ -1252,7 +1252,7 @@ class PesterWindow(MovingWindow):
PchumLog.error("Caught: " + inst.parameter) PchumLog.error("Caught: " + inst.parameter)
themeWarning = QtWidgets.QMessageBox(self) themeWarning = QtWidgets.QMessageBox(self)
themeWarning.setText("Theme Error: %s" % inst) themeWarning.setText("Theme Error: %s" % inst)
themeWarning.exec_() themeWarning.exec()
self.theme = pesterTheme("pesterchum") self.theme = pesterTheme("pesterchum")
extraToasts = {'default': PesterToast} extraToasts = {'default': PesterToast}
@ -1266,35 +1266,35 @@ class PesterWindow(MovingWindow):
self.move(100, 100) self.move(100, 100)
talk = QtWidgets.QAction(self.theme["main/menus/client/talk"], self) talk = QtGui.QAction(self.theme["main/menus/client/talk"], self)
self.talk = talk self.talk = talk
talk.triggered.connect(self.openChat) talk.triggered.connect(self.openChat)
logv = QtWidgets.QAction(self.theme["main/menus/client/logviewer"], self) logv = QtGui.QAction(self.theme["main/menus/client/logviewer"], self)
self.logv = logv self.logv = logv
logv.triggered.connect(self.openLogv) logv.triggered.connect(self.openLogv)
grps = QtWidgets.QAction(self.theme["main/menus/client/addgroup"], self) grps = QtGui.QAction(self.theme["main/menus/client/addgroup"], self)
self.grps = grps self.grps = grps
grps.triggered.connect(self.addGroupWindow) grps.triggered.connect(self.addGroupWindow)
self.rand = QtWidgets.QAction(self.theme["main/menus/client/randen"], self) self.rand = QtGui.QAction(self.theme["main/menus/client/randen"], self)
self.rand.triggered.connect(self.randhandler.getEncounter) self.rand.triggered.connect(self.randhandler.getEncounter)
opts = QtWidgets.QAction(self.theme["main/menus/client/options"], self) opts = QtGui.QAction(self.theme["main/menus/client/options"], self)
self.opts = opts self.opts = opts
opts.triggered.connect(self.openOpts) opts.triggered.connect(self.openOpts)
exitaction = QtWidgets.QAction(self.theme["main/menus/client/exit"], self) exitaction = QtGui.QAction(self.theme["main/menus/client/exit"], self)
self.exitaction = exitaction self.exitaction = exitaction
exitaction.triggered.connect(self.quit) exitaction.triggered.connect(self.quit)
userlistaction = QtWidgets.QAction(self.theme["main/menus/client/userlist"], self) userlistaction = QtGui.QAction(self.theme["main/menus/client/userlist"], self)
self.userlistaction = userlistaction self.userlistaction = userlistaction
userlistaction.triggered.connect(self.showAllUsers) userlistaction.triggered.connect(self.showAllUsers)
memoaction = QtWidgets.QAction(self.theme["main/menus/client/memos"], self) memoaction = QtGui.QAction(self.theme["main/menus/client/memos"], self)
self.memoaction = memoaction self.memoaction = memoaction
memoaction.triggered.connect(self.showMemos) memoaction.triggered.connect(self.showMemos)
self.importaction = QtWidgets.QAction(self.theme["main/menus/client/import"], self) self.importaction = QtGui.QAction(self.theme["main/menus/client/import"], self)
self.importaction.triggered.connect(self.importExternalConfig) self.importaction.triggered.connect(self.importExternalConfig)
self.idleaction = QtWidgets.QAction(self.theme["main/menus/client/idle"], self) self.idleaction = QtGui.QAction(self.theme["main/menus/client/idle"], self)
self.idleaction.setCheckable(True) self.idleaction.setCheckable(True)
self.idleaction.toggled[bool].connect(self.toggleIdle) self.idleaction.toggled[bool].connect(self.toggleIdle)
self.reconnectAction = QtWidgets.QAction(self.theme["main/menus/client/reconnect"], self) self.reconnectAction = QtGui.QAction(self.theme["main/menus/client/reconnect"], self)
self.reconnectAction.triggered.connect(self.reconnectIRC) self.reconnectAction.triggered.connect(self.reconnectIRC)
self.menu = QtWidgets.QMenuBar(self) self.menu = QtWidgets.QMenuBar(self)
@ -1304,25 +1304,25 @@ class PesterWindow(MovingWindow):
if self.theme.has_key("main/menus/client/console"): if self.theme.has_key("main/menus/client/console"):
self.console = AttrDict(dict( self.console = AttrDict(dict(
window = None, window = None,
action = QtWidgets.QAction(self.theme["main/menus/client/console"], self), action = QtGui.QAction(self.theme["main/menus/client/console"], self),
is_open = False is_open = False
)) ))
else: else:
self.console = AttrDict(dict( self.console = AttrDict(dict(
window = None, window = None,
action = QtWidgets.QAction("Console", self), action = QtGui.QAction("Console", self),
is_open = False is_open = False
)) ))
self.console.shortcuts = AttrDict(dict( self.console.shortcuts = AttrDict(dict(
conkey = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+`"), self, conkey = QtGui.QShortcut(QtGui.QKeySequence("Ctrl+`"), self,
context=QtCore.Qt.ApplicationShortcut), context=QtCore.Qt.ShortcutContext.ApplicationShortcut),
curwgt = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Alt+w"), self, curwgt = QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Alt+w"), self,
context=QtCore.Qt.ApplicationShortcut) context=QtCore.Qt.ShortcutContext.ApplicationShortcut)
)) ))
self.console.action.triggered.connect(self.toggleConsole) self.console.action.triggered.connect(self.toggleConsole)
# Make sure the shortcut works anywhere. # Make sure the shortcut works anywhere.
# karxi: There's something wrong with the inheritance scheme here. # karxi: There's something wrong with the inheritance scheme here.
#~self.console.shortcuts.conkey.setContext(QtCore.Qt.ApplicationShortcut) #~self.console.shortcuts.conkey.setContext(QtCore.Qt.ShortcutContext.ApplicationShortcut)
self.console.shortcuts.conkey.activated.connect(self.toggleConsole) self.console.shortcuts.conkey.activated.connect(self.toggleConsole)
#~# Use new-style connections #~# Use new-style connections
#~self.console.shortcut.activated.connect(self.toggleConsole) #~self.console.shortcut.activated.connect(self.toggleConsole)
@ -1349,18 +1349,18 @@ class PesterWindow(MovingWindow):
filemenu.addAction(self.reconnectAction) filemenu.addAction(self.reconnectAction)
filemenu.addAction(exitaction) filemenu.addAction(exitaction)
changequirks = QtWidgets.QAction(self.theme["main/menus/profile/quirks"], self) changequirks = QtGui.QAction(self.theme["main/menus/profile/quirks"], self)
self.changequirks = changequirks self.changequirks = changequirks
changequirks.triggered.connect(self.openQuirks) changequirks.triggered.connect(self.openQuirks)
loadslum = QtWidgets.QAction(self.theme["main/menus/profile/block"], self) loadslum = QtGui.QAction(self.theme["main/menus/profile/block"], self)
self.loadslum = loadslum self.loadslum = loadslum
loadslum.triggered.connect(self.showTrollSlum) loadslum.triggered.connect(self.showTrollSlum)
changecoloraction = QtWidgets.QAction(self.theme["main/menus/profile/color"], self) changecoloraction = QtGui.QAction(self.theme["main/menus/profile/color"], self)
self.changecoloraction = changecoloraction self.changecoloraction = changecoloraction
changecoloraction.triggered.connect(self.changeMyColor) changecoloraction.triggered.connect(self.changeMyColor)
switch = QtWidgets.QAction(self.theme["main/menus/profile/switch"], self) switch = QtGui.QAction(self.theme["main/menus/profile/switch"], self)
self.switch = switch self.switch = switch
switch.triggered.connect(self.switchProfile) switch.triggered.connect(self.switchProfile)
@ -1371,27 +1371,27 @@ class PesterWindow(MovingWindow):
profilemenu.addAction(changecoloraction) profilemenu.addAction(changecoloraction)
profilemenu.addAction(switch) profilemenu.addAction(switch)
self.helpAction = QtWidgets.QAction(self.theme["main/menus/help/help"], self) self.helpAction = QtGui.QAction(self.theme["main/menus/help/help"], self)
self.helpAction.triggered.connect(self.launchHelp) self.helpAction.triggered.connect(self.launchHelp)
self.botAction = QtWidgets.QAction(self.theme["main/menus/help/calsprite"], self) self.botAction = QtGui.QAction(self.theme["main/menus/help/calsprite"], self)
self.botAction.triggered.connect(self.loadCalsprite) self.botAction.triggered.connect(self.loadCalsprite)
self.nickServAction = QtWidgets.QAction(self.theme["main/menus/help/nickserv"], self) self.nickServAction = QtGui.QAction(self.theme["main/menus/help/nickserv"], self)
self.nickServAction.triggered.connect(self.loadNickServ) self.nickServAction.triggered.connect(self.loadNickServ)
self.chanServAction = QtWidgets.QAction(self.theme["main/menus/help/chanserv"], self) self.chanServAction = QtGui.QAction(self.theme["main/menus/help/chanserv"], self)
self.chanServAction.triggered.connect(self.loadChanServ) self.chanServAction.triggered.connect(self.loadChanServ)
self.aboutAction = QtWidgets.QAction(self.theme["main/menus/help/about"], self) self.aboutAction = QtGui.QAction(self.theme["main/menus/help/about"], self)
self.aboutAction.triggered.connect(self.aboutPesterchum) self.aboutAction.triggered.connect(self.aboutPesterchum)
# Because I can't expect all themes to have this included. # Because I can't expect all themes to have this included.
#if self.theme.has_key("main/menus/help/reportbug"): #if self.theme.has_key("main/menus/help/reportbug"):
try: try:
self.reportBugAction = QtWidgets.QAction(self.theme["main/menus/help/reportbug"], self) self.reportBugAction = QtGui.QAction(self.theme["main/menus/help/reportbug"], self)
except: except:
self.reportBugAction = QtWidgets.QAction("REPORT BUG", self) self.reportBugAction = QtGui.QAction("REPORT BUG", self)
try: try:
self.xyzRulesAction = QtWidgets.QAction(self.theme["main/menus/help/rules"], self) self.xyzRulesAction = QtGui.QAction(self.theme["main/menus/help/rules"], self)
except: except:
self.xyzRulesAction = QtWidgets.QAction("RULES", self) self.xyzRulesAction = QtGui.QAction("RULES", self)
self.reportBugAction.triggered.connect(self.reportBug) self.reportBugAction.triggered.connect(self.reportBug)
self.xyzRulesAction.triggered.connect(self.xyzRules) self.xyzRulesAction.triggered.connect(self.xyzRules)
@ -1561,7 +1561,7 @@ class PesterWindow(MovingWindow):
else: else:
palette = QtGui.QPalette() palette = QtGui.QPalette()
brush = QtGui.QBrush(self.backgroundImage) brush = QtGui.QBrush(self.backgroundImage)
palette.setBrush(QtGui.QPalette.Window, brush) palette.setBrush(QtGui.QPalette.ColorRole.Window, brush)
self.setPalette(palette) self.setPalette(palette)
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
@ -1857,28 +1857,22 @@ class PesterWindow(MovingWindow):
self.chooseprofile = None self.chooseprofile = None
if not self.chooseprofile: if not self.chooseprofile:
self.chooseprofile = PesterChooseProfile(self.userprofile, self.config, self.theme, self, collision=collision) self.chooseprofile = PesterChooseProfile(self.userprofile, self.config, self.theme, self, collision=collision)
self.chooseprofile.exec_() self.chooseprofile.exec()
def themePicker(self): def themePicker(self):
if not hasattr(self, 'choosetheme'): if not hasattr(self, 'choosetheme'):
self.choosetheme = None self.choosetheme = None
if not self.choosetheme: if not self.choosetheme:
self.choosetheme = PesterChooseTheme(self.config, self.theme, self) self.choosetheme = PesterChooseTheme(self.config, self.theme, self)
self.choosetheme.exec_() self.choosetheme.exec()
def initTheme(self, theme): def initTheme(self, theme):
self.resize(*theme["main/size"]) self.resize(*theme["main/size"])
self.setWindowIcon(PesterIcon(theme["main/icon"])) self.setWindowIcon(PesterIcon(theme["main/icon"]))
self.setWindowTitle(theme["main/windowtitle"]) self.setWindowTitle(theme["main/windowtitle"])
self.setStyleSheet("QtWidgets.QFrame#main { %s }" % (theme["main/style"])) self.setStyleSheet("QtWidgets.QFrame#main { %s }" % (theme["main/style"]))
# QPixmap::mask and setMask are legacy and should probably be replaced; self.backgroundImage = QtGui.QPixmap(theme["main/background-image"])
# https://doc.qt.io/qt-5/qpixmap.html#pixmap-information self.setMask(self.backgroundImage.mask())
# It's slow and this way we don't use antialiasing, leaving us with very ugly borders.
# + It breaks transparency on Wayland: https://bugreports-test.qt.io/browse/QTBUG-69906
self.backgroundImage = QtGui.QImage(theme["main/background-image"])
self.backgroundPixmap = QtGui.QPixmap.fromImage(self.backgroundImage)
self.backgroundMask = self.backgroundPixmap.mask()
self.setMask(self.backgroundMask)
self.menu.setStyleSheet("QMenuBar { background: transparent; %s } QMenuBar::item { background: transparent; %s } " self.menu.setStyleSheet("QMenuBar { background: transparent; %s } QMenuBar::item { background: transparent; %s } "
% (theme["main/menubar/style"], % (theme["main/menubar/style"],
@ -2100,7 +2094,7 @@ class PesterWindow(MovingWindow):
except ThemeException as inst: except ThemeException as inst:
themeWarning = QtWidgets.QMessageBox(self) themeWarning = QtWidgets.QMessageBox(self)
themeWarning.setText("Theme Error: %s" % inst) themeWarning.setText("Theme Error: %s" % inst)
themeWarning.exec_() themeWarning.exec()
theme = pesterTheme("pesterchum") theme = pesterTheme("pesterchum")
return return
self.theme = theme self.theme = theme
@ -2164,7 +2158,7 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def connected(self): def connected(self):
if self.loadingscreen: if self.loadingscreen:
self.loadingscreen.done(QtWidgets.QDialog.Accepted) self.loadingscreen.done(QtWidgets.QDialog.DialogCode.Accepted)
self.loadingscreen = None self.loadingscreen = None
self.doAutoIdentify() self.doAutoIdentify()
@ -2259,7 +2253,7 @@ class PesterWindow(MovingWindow):
msgbox.setText("This chumhandle has been registered; you may not use it.") msgbox.setText("This chumhandle has been registered; you may not use it.")
msgbox.setInformativeText("Your handle is now being changed to %s." % (changedto)) msgbox.setInformativeText("Your handle is now being changed to %s." % (changedto))
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.exec_() msgbox.exec()
elif h == self.randhandler.randNick: elif h == self.randhandler.randNick:
self.randhandler.incoming(msg) self.randhandler.incoming(msg)
elif h in self.convos: elif h in self.convos:
@ -2286,7 +2280,7 @@ class PesterWindow(MovingWindow):
# already stealing focus # already stealing focus
b.setFocus() b.setFocus()
break break
ret = msgbox.exec_() ret = msgbox.exec()
if ret == QtWidgets.QMessageBox.Ok: if ret == QtWidgets.QMessageBox.Ok:
self.newMemo(str(channel), "+0:00") self.newMemo(str(channel), "+0:00")
@QtCore.pyqtSlot(QString) @QtCore.pyqtSlot(QString)
@ -2374,7 +2368,7 @@ class PesterWindow(MovingWindow):
if not self.addchumdialog: if not self.addchumdialog:
available_groups = [g[0] for g in self.config.getGroups()] available_groups = [g[0] for g in self.config.getGroups()]
self.addchumdialog = AddChumDialog(available_groups, self) self.addchumdialog = AddChumDialog(available_groups, self)
ok = self.addchumdialog.exec_() ok = self.addchumdialog.exec()
handle = str(self.addchumdialog.chumBox.text()).strip() handle = str(self.addchumdialog.chumBox.text()).strip()
newgroup = str(self.addchumdialog.newgroup.text()).strip() newgroup = str(self.addchumdialog.newgroup.text()).strip()
selectedGroup = self.addchumdialog.groupBox.currentText() selectedGroup = self.addchumdialog.groupBox.currentText()
@ -2655,7 +2649,7 @@ class PesterWindow(MovingWindow):
curgroup = str(self.quirkmenu.quirkList.topLevelItem(i).text(0)) curgroup = str(self.quirkmenu.quirkList.topLevelItem(i).text(0))
for j in range(self.quirkmenu.quirkList.topLevelItem(i).childCount()): for j in range(self.quirkmenu.quirkList.topLevelItem(i).childCount()):
item = self.quirkmenu.quirkList.topLevelItem(i).child(j) item = self.quirkmenu.quirkList.topLevelItem(i).child(j)
item.quirk.quirk["on"] = item.quirk.on = (item.checkState(0) == QtCore.Qt.Checked) item.quirk.quirk["on"] = item.quirk.on = (item.checkState(0) == QtCore.Qt.CheckState.Checked)
item.quirk.quirk["group"] = item.quirk.group = curgroup item.quirk.quirk["group"] = item.quirk.group = curgroup
quirks = pesterQuirks(self.quirkmenu.quirks()) quirks = pesterQuirks(self.quirkmenu.quirks())
self.userprofile.setQuirks(quirks) self.userprofile.setQuirks(quirks)
@ -2709,7 +2703,7 @@ class PesterWindow(MovingWindow):
msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME") msgbox.setInformativeText("THIS IS NOT A VALID GROUP NAME")
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.setStyleSheet("QMessageBox{" + self.theme["main/defaultwindow/style"] + "}")#Style :) (memos/style or convo/style works :3 ) msgbox.setStyleSheet("QMessageBox{" + self.theme["main/defaultwindow/style"] + "}")#Style :) (memos/style or convo/style works :3 )
msgbox.exec_() msgbox.exec()
self.addgroupdialog = None self.addgroupdialog = None
return return
self.addGroup(gname) self.addGroup(gname)
@ -3016,7 +3010,7 @@ class PesterWindow(MovingWindow):
except ValueError as e: except ValueError as e:
themeWarning = QtWidgets.QMessageBox(self) themeWarning = QtWidgets.QMessageBox(self)
themeWarning.setText("Theme Error: %s" % (e)) themeWarning.setText("Theme Error: %s" % (e))
themeWarning.exec_() themeWarning.exec()
self.choosetheme = None self.choosetheme = None
return return
# update profile # update profile
@ -3040,7 +3034,7 @@ class PesterWindow(MovingWindow):
msgBox = QtWidgets.QMessageBox() msgBox = QtWidgets.QMessageBox()
msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setIcon(QtWidgets.QMessageBox.Warning)
msgBox.setWindowTitle(":(") msgBox.setWindowTitle(":(")
msgBox.setTextFormat(QtCore.Qt.RichText) # Clickable html links msgBox.setTextFormat(QtCore.Qt.TextFormat.RichText) # Clickable html links
self.filename = _datadir+"pesterchum.js" self.filename = _datadir+"pesterchum.js"
try: try:
msgBox.setText("<html><h3>Failed to load: " + ("<a href='%s'>%s/%s.js</a>" % (self.profiledir, self.profiledir, user)) + \ msgBox.setText("<html><h3>Failed to load: " + ("<a href='%s'>%s/%s.js</a>" % (self.profiledir, self.profiledir, user)) + \
@ -3058,7 +3052,7 @@ class PesterWindow(MovingWindow):
"<br><br>" + str(e) + "<\h3><\html>") "<br><br>" + str(e) + "<\h3><\html>")
PchumLog.critical(e) PchumLog.critical(e)
msgBox.exec_() msgBox.exec()
return return
else: else:
handle = str(self.chooseprofile.chumHandle.text()) handle = str(self.chooseprofile.chumHandle.text())
@ -3120,7 +3114,7 @@ class PesterWindow(MovingWindow):
closeWarning.setInformativeText("i warned you about windows bro!!!! i told you dog!") closeWarning.setInformativeText("i warned you about windows bro!!!! i told you dog!")
closeWarning.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok) closeWarning.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
closeWarning.setDefaultButton(QtWidgets.QMessageBox.Ok) closeWarning.setDefaultButton(QtWidgets.QMessageBox.Ok)
ret = closeWarning.exec_() ret = closeWarning.exec()
if ret == QtWidgets.QMessageBox.Cancel: if ret == QtWidgets.QMessageBox.Cancel:
return return
self.changeProfile() self.changeProfile()
@ -3138,7 +3132,7 @@ class PesterWindow(MovingWindow):
if hasattr(self, 'aboutwindow') and self.aboutwindow: if hasattr(self, 'aboutwindow') and self.aboutwindow:
return return
self.aboutwindow = AboutPesterchum(self) self.aboutwindow = AboutPesterchum(self)
self.aboutwindow.exec_() self.aboutwindow.exec()
self.aboutwindow = None self.aboutwindow = None
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def loadCalsprite(self): def loadCalsprite(self):
@ -3151,15 +3145,15 @@ class PesterWindow(MovingWindow):
self.newConversation("nickServ") self.newConversation("nickServ")
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def launchHelp(self): def launchHelp(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://github.com/Dpeta/pesterchum-alt-servers/issues", QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://github.com/Dpeta/pesterchum-alt-servers/issues", QtCore.QUrl.ParsingMode.TolerantMode))
QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://forum.homestuck.xyz/viewtopic.php?f=7&t=467", QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://forum.homestuck.xyz/viewtopic.php?f=7&t=467", QtCore.QUrl.ParsingMode.TolerantMode))
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def reportBug(self): def reportBug(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://github.com/Dpeta/pesterchum-alt-servers/issues", QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://github.com/Dpeta/pesterchum-alt-servers/issues", QtCore.QUrl.ParsingMode.TolerantMode))
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def xyzRules(self): def xyzRules(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://www.pesterchum.xyz/pesterchum-rules", QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl("https://www.pesterchum.xyz/pesterchum-rules", QtCore.QUrl.ParsingMode.TolerantMode))
@QtCore.pyqtSlot(QString, QString) @QtCore.pyqtSlot(QString, QString)
def nickCollision(self, handle, tmphandle): def nickCollision(self, handle, tmphandle):
@ -3186,10 +3180,10 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot(QtWidgets.QSystemTrayIcon.ActivationReason) @QtCore.pyqtSlot(QtWidgets.QSystemTrayIcon.ActivationReason)
def systemTrayActivated(self, reason): def systemTrayActivated(self, reason):
if reason == QtWidgets.QSystemTrayIcon.Trigger: if reason == QtWidgets.QSystemTrayIcon.ActivationReason.Trigger:
self.systemTrayFunction() self.systemTrayFunction()
elif reason == QtWidgets.QSystemTrayIcon.Context: #elif reason == QtWidgets.QSystemTrayIcon.Context:
pass # pass
# show context menu i guess # show context menu i guess
#self.showTrayContext.emit() #self.showTrayContext.emit()
@ -3236,7 +3230,7 @@ class PesterWindow(MovingWindow):
msgbox.setWindowIcon(PesterIcon(self.theme["main/icon"])) msgbox.setWindowIcon(PesterIcon(self.theme["main/icon"]))
msgbox.setInformativeText("Incorrect format :(") msgbox.setInformativeText("Incorrect format :(")
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
msgbox.exec_() msgbox.exec()
self.chooseServer() self.chooseServer()
return 1 return 1
@ -3271,7 +3265,7 @@ class PesterWindow(MovingWindow):
+ "Please tell me if this error occurs :'3") + "Please tell me if this error occurs :'3")
msgbox.addButton(QtWidgets.QPushButton("Yes"), QtWidgets.QMessageBox.YesRole) msgbox.addButton(QtWidgets.QPushButton("Yes"), QtWidgets.QMessageBox.YesRole)
msgbox.addButton(QtWidgets.QPushButton("No"), QtWidgets.QMessageBox.NoRole) msgbox.addButton(QtWidgets.QPushButton("No"), QtWidgets.QMessageBox.NoRole)
msgbox.exec_() msgbox.exec()
reply = msgbox.buttonRole(msgbox.clickedButton()) reply = msgbox.buttonRole(msgbox.clickedButton())
if (reply==QtWidgets.QMessageBox.YesRole): if (reply==QtWidgets.QMessageBox.YesRole):
@ -3645,14 +3639,14 @@ class MainProgram(QtCore.QObject):
moodCategories[k] = moodMenu.addMenu(k.upper()) moodCategories[k] = moodMenu.addMenu(k.upper())
self.moodactions = {} self.moodactions = {}
for (i,m) in enumerate(Mood.moods): for (i,m) in enumerate(Mood.moods):
maction = QtWidgets.QAction(m.upper(), self) maction = QtGui.QAction(m.upper(), self)
mobj = PesterMoodAction(i, self.widget.moods.updateMood) mobj = PesterMoodAction(i, self.widget.moods.updateMood)
maction.triggered.connect(mobj.updateMood) maction.triggered.connect(mobj.updateMood)
self.moodactions[i] = mobj self.moodactions[i] = mobj
moodCategories[Mood.revmoodcats[m]].addAction(maction) moodCategories[Mood.revmoodcats[m]].addAction(maction)
miniAction = QtWidgets.QAction("MINIMIZE", self) miniAction = QtGui.QAction("MINIMIZE", self)
miniAction.triggered.connect(self.widget.showMinimized) miniAction.triggered.connect(self.widget.showMinimized)
exitAction = QtWidgets.QAction("EXIT", self) exitAction = QtGui.QAction("EXIT", self)
exitAction.triggered.connect(PesterWindow.quit) exitAction.triggered.connect(PesterWindow.quit)
self.traymenu.addAction(miniAction) self.traymenu.addAction(miniAction)
self.traymenu.addAction(exitAction) self.traymenu.addAction(exitAction)
@ -3859,8 +3853,8 @@ Click this message to never see this again.")
widget.loadingscreen.showReconnect() widget.loadingscreen.showReconnect()
else: else:
widget.loadingscreen.hideReconnect() widget.loadingscreen.hideReconnect()
status = widget.loadingscreen.exec_() status = widget.loadingscreen.exec()
if status == QtWidgets.QDialog.Rejected: if status == QtWidgets.QDialog.DialogCode.Rejected:
sys.exit(0) sys.exit(0)
else: else:
if self.widget.tabmemo: if self.widget.tabmemo:
@ -3879,7 +3873,7 @@ Click this message to never see this again.")
if not self.reconnectok: if not self.reconnectok:
return return
if self.widget.loadingscreen: if self.widget.loadingscreen:
self.widget.loadingscreen.done(QtWidgets.QDialog.Accepted) self.widget.loadingscreen.done(QtWidgets.QDialog.DialogCode.Accepted)
self.widget.loadingscreen = None self.widget.loadingscreen = None
self.attempts += 1 self.attempts += 1
if hasattr(self, 'irc') and self.irc: if hasattr(self, 'irc') and self.irc:
@ -3930,7 +3924,7 @@ Click this message to never see this again.")
def run(self): def run(self):
#PchumLog.critical("mreowww") <--- debug thingy :3 #PchumLog.critical("mreowww") <--- debug thingy :3
sys.exit(self.app.exec_()) sys.exit(self.app.exec())
def _retrieveGlobals(): def _retrieveGlobals():
# NOTE: Yes, this is a terrible kludge so that the console can work # NOTE: Yes, this is a terrible kludge so that the console can work

View file

@ -11,7 +11,7 @@ from string import Template
from datetime import datetime from datetime import datetime
from time import strftime from time import strftime
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import ostools import ostools
from mood import Mood from mood import Mood
@ -71,7 +71,7 @@ class PesterLog(object):
errmsg.setText("Warning: Pesterchum could not open the log file for %s!" % (handle)) errmsg.setText("Warning: Pesterchum could not open the log file for %s!" % (handle))
errmsg.setInformativeText("Your log for %s will not be saved because something went wrong. We suggest restarting Pesterchum. Sorry :(" % (handle)) errmsg.setInformativeText("Your log for %s will not be saved because something went wrong. We suggest restarting Pesterchum. Sorry :(" % (handle))
errmsg.setWindowTitle(":(") errmsg.setWindowTitle(":(")
errmsg.exec_() errmsg.exec()
PchumLog.debug("post-error msg") PchumLog.debug("post-error msg")
self.convos[handle][format] = fp self.convos[handle][format] = fp
@ -128,11 +128,11 @@ class userConfig(object):
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
msgbox.setIcon(QtWidgets.QMessageBox.Warning) msgbox.setIcon(QtWidgets.QMessageBox.Warning)
msgbox.setWindowTitle(":(") msgbox.setWindowTitle(":(")
msgbox.setTextFormat(QtCore.Qt.RichText) # Clickable html links msgbox.setTextFormat(QtCore.Qt.TextFormat.RichText) # Clickable html links
msgbox.setInformativeText("<html><h3>Failed to load pesterchum.js, this might require manual intervention.<br><br>\ msgbox.setInformativeText("<html><h3>Failed to load pesterchum.js, this might require manual intervention.<br><br>\
Consider overriding: <a href='%s'>%s</a> <br>\ Consider overriding: <a href='%s'>%s</a> <br>\
with a backup from: <a href='%s'>%s</a></h3></html>" % (_datadir, self.filename, os.path.join(_datadir, "backup"), os.path.join(_datadir, "backup"))) with a backup from: <a href='%s'>%s</a></h3></html>" % (_datadir, self.filename, os.path.join(_datadir, "backup"), os.path.join(_datadir, "backup")))
msgbox.exec_() msgbox.exec()
sys.exit() sys.exit()
# Trying to fix: # Trying to fix:
@ -472,7 +472,7 @@ with a backup from: <a href='%s'>%s</a></h3></html>" % (_datadir, self.filename,
msgBox = QtWidgets.QMessageBox() msgBox = QtWidgets.QMessageBox()
msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setIcon(QtWidgets.QMessageBox.Warning)
msgBox.setWindowTitle(":(") msgBox.setWindowTitle(":(")
msgBox.setTextFormat(QtCore.Qt.RichText) # Clickable html links msgBox.setTextFormat(QtCore.Qt.TextFormat.RichText) # Clickable html links
self.filename = _datadir+"pesterchum.js" self.filename = _datadir+"pesterchum.js"
msgBox.setText("<html><h3>Failed to load " + x + ", removed from list." + \ msgBox.setText("<html><h3>Failed to load " + x + ", removed from list." + \
"<br><br>Consider taking a look at: <a href=" + profileloc + ">"+ os.path.join(profileloc, x + ".js") + "</a>" + \ "<br><br>Consider taking a look at: <a href=" + profileloc + ">"+ os.path.join(profileloc, x + ".js") + "</a>" + \
@ -481,7 +481,7 @@ with a backup from: <a href='%s'>%s</a></h3></html>" % (_datadir, self.filename,
#_datadir+"pesterchum.js" + \ #_datadir+"pesterchum.js" + \
#"\"") #"\"")
PchumLog.critical(e) PchumLog.critical(e)
msgBox.exec_() msgBox.exec()
return [userProfile(p) for p in profs] return [userProfile(p) for p in profs]
@ -521,7 +521,7 @@ class userProfile(object):
msgBox = QtWidgets.QMessageBox() msgBox = QtWidgets.QMessageBox()
msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setIcon(QtWidgets.QMessageBox.Warning)
msgBox.setWindowTitle(":(") msgBox.setWindowTitle(":(")
msgBox.setTextFormat(QtCore.Qt.RichText) # Clickable html links msgBox.setTextFormat(QtCore.Qt.TextFormat.RichText) # Clickable html links
self.filename = _datadir+"pesterchum.js" self.filename = _datadir+"pesterchum.js"
msgBox.setText("<html><h3>Failed to load: " + ("<a href='%s'>%s/%s.js</a>" % (self.profiledir, self.profiledir, user)) + \ msgBox.setText("<html><h3>Failed to load: " + ("<a href='%s'>%s/%s.js</a>" % (self.profiledir, self.profiledir, user)) + \
"<br><br> Try to check for syntax errors if the file exists." + \ "<br><br> Try to check for syntax errors if the file exists." + \
@ -531,7 +531,7 @@ class userProfile(object):
#_datadir+"pesterchum.js" + \ #_datadir+"pesterchum.js" + \
#"\"") #"\"")
PchumLog.critical(e) PchumLog.critical(e)
msgBox.exec_() msgBox.exec()
raise ValueError(e) raise ValueError(e)
try: try:

View file

@ -1,425 +1,425 @@
import os import os
import sys import sys
import shutil import shutil
import PyInstaller.__main__ import PyInstaller.__main__
is_64bit = sys.maxsize > 2**32 is_64bit = sys.maxsize > 2**32
exclude_modules = [] exclude_modules = []
add_data = ['quirks;quirks', add_data = ['quirks;quirks',
'smilies;smilies', 'smilies;smilies',
'themes;themes', 'themes;themes',
'docs;docs', 'docs;docs',
'README.md;.', 'README.md;.',
'LICENSE;.', 'LICENSE;.',
'CHANGELOG.md;.', 'CHANGELOG.md;.',
'PCskins.png;.', 'PCskins.png;.',
'Pesterchum.png;.'] 'Pesterchum.png;.']
data_folders = {'quirks': 'quirks', data_folders = {'quirks': 'quirks',
'smilies': 'smilies', 'smilies': 'smilies',
'themes': 'themes', 'themes': 'themes',
'docs': 'docs'} 'docs': 'docs'}
data_files = {'README.md': 'README.md.txt', data_files = {'README.md': 'README.md.txt',
'LICENSE': 'LICENSE.txt', 'LICENSE': 'LICENSE.txt',
'CHANGELOG.md': 'CHANGELOG.md.txt', 'CHANGELOG.md': 'CHANGELOG.md.txt',
'PCskins.png': '.', 'PCskins.png': '.',
'Pesterchum.png': '.'} 'Pesterchum.png': '.'}
data_files_linux = {'README.md': 'README.md', data_files_linux = {'README.md': 'README.md',
'LICENSE': 'LICENSE.txt', 'LICENSE': 'LICENSE.txt',
'CHANGELOG.md': 'CHANGELOG.md', 'CHANGELOG.md': 'CHANGELOG.md',
'PCskins.png': '.', 'PCskins.png': '.',
'Pesterchum.png': '.'} 'Pesterchum.png': '.'}
# Some of these might not be required anymore, # Some of these might not be required anymore,
# newer versions of PyInstaller claim to exclude certain problematic DDLs automatically. # newer versions of PyInstaller claim to exclude certain problematic DDLs automatically.
upx_exclude = ["qwindows.dll", upx_exclude = ["qwindows.dll",
"Qt5Core.dll", "Qt5Core.dll",
"Qt5Gui.dll", "Qt5Gui.dll",
"vcruntime140.dll", "vcruntime140.dll",
"MSVCP140.dll", "MSVCP140.dll",
"MSVCP140_1.dll" "MSVCP140_1.dll"
"api-ms-win-core-console-l1-1-0.dll",\ "api-ms-win-core-console-l1-1-0.dll",\
"api-ms-win-core-console-l1-1-0.dll",\ "api-ms-win-core-console-l1-1-0.dll",\
"api-ms-win-core-console-l1-2-0.dll",\ "api-ms-win-core-console-l1-2-0.dll",\
"api-ms-win-core-datetime-l1-1-0.dll",\ "api-ms-win-core-datetime-l1-1-0.dll",\
"api-ms-win-core-debug-l1-1-0.dll",\ "api-ms-win-core-debug-l1-1-0.dll",\
"api-ms-win-core-errorhandling-l1-1-0.dll",\ "api-ms-win-core-errorhandling-l1-1-0.dll",\
"api-ms-win-core-file-l1-1-0.dll",\ "api-ms-win-core-file-l1-1-0.dll",\
"api-ms-win-core-file-l1-2-0.dll",\ "api-ms-win-core-file-l1-2-0.dll",\
"api-ms-win-core-file-l2-1-0.dll",\ "api-ms-win-core-file-l2-1-0.dll",\
"api-ms-win-core-handle-l1-1-0.dll",\ "api-ms-win-core-handle-l1-1-0.dll",\
"api-ms-win-core-heap-l1-1-0.dll",\ "api-ms-win-core-heap-l1-1-0.dll",\
"api-ms-win-core-interlocked-l1-1-0.dll",\ "api-ms-win-core-interlocked-l1-1-0.dll",\
"api-ms-win-core-libraryloader-l1-1-0.dll",\ "api-ms-win-core-libraryloader-l1-1-0.dll",\
"api-ms-win-core-localization-l1-2-0.dll",\ "api-ms-win-core-localization-l1-2-0.dll",\
"api-ms-win-core-memory-l1-1-0.dll",\ "api-ms-win-core-memory-l1-1-0.dll",\
"api-ms-win-core-namedpipe-l1-1-0.dll",\ "api-ms-win-core-namedpipe-l1-1-0.dll",\
"api-ms-win-core-processenvironment-l1-1-0.dll",\ "api-ms-win-core-processenvironment-l1-1-0.dll",\
"api-ms-win-core-processthreads-l1-1-0.dll",\ "api-ms-win-core-processthreads-l1-1-0.dll",\
"api-ms-win-core-processthreads-l1-1-1.dll",\ "api-ms-win-core-processthreads-l1-1-1.dll",\
"api-ms-win-core-profile-l1-1-0.dll",\ "api-ms-win-core-profile-l1-1-0.dll",\
"api-ms-win-core-rtlsupport-l1-1-0.dll",\ "api-ms-win-core-rtlsupport-l1-1-0.dll",\
"api-ms-win-core-string-l1-1-0.dll",\ "api-ms-win-core-string-l1-1-0.dll",\
"api-ms-win-core-synch-l1-1-0.dll",\ "api-ms-win-core-synch-l1-1-0.dll",\
"api-ms-win-core-synch-l1-2-0.dll",\ "api-ms-win-core-synch-l1-2-0.dll",\
"api-ms-win-core-sysinfo-l1-1-0.dll",\ "api-ms-win-core-sysinfo-l1-1-0.dll",\
"api-ms-win-core-timezone-l1-1-0.dll",\ "api-ms-win-core-timezone-l1-1-0.dll",\
"api-ms-win-core-util-l1-1-0.dll",\ "api-ms-win-core-util-l1-1-0.dll",\
"API-MS-Win-core-xstate-l2-1-0.dll",\ "API-MS-Win-core-xstate-l2-1-0.dll",\
"api-ms-win-crt-conio-l1-1-0.dll",\ "api-ms-win-crt-conio-l1-1-0.dll",\
"api-ms-win-crt-convert-l1-1-0.dll",\ "api-ms-win-crt-convert-l1-1-0.dll",\
"api-ms-win-crt-environment-l1-1-0.dll",\ "api-ms-win-crt-environment-l1-1-0.dll",\
"api-ms-win-crt-filesystem-l1-1-0.dll",\ "api-ms-win-crt-filesystem-l1-1-0.dll",\
"api-ms-win-crt-heap-l1-1-0.dll",\ "api-ms-win-crt-heap-l1-1-0.dll",\
"api-ms-win-crt-locale-l1-1-0.dll",\ "api-ms-win-crt-locale-l1-1-0.dll",\
"api-ms-win-crt-math-l1-1-0.dll",\ "api-ms-win-crt-math-l1-1-0.dll",\
"api-ms-win-crt-multibyte-l1-1-0.dll",\ "api-ms-win-crt-multibyte-l1-1-0.dll",\
"api-ms-win-crt-private-l1-1-0.dll",\ "api-ms-win-crt-private-l1-1-0.dll",\
"api-ms-win-crt-process-l1-1-0.dll",\ "api-ms-win-crt-process-l1-1-0.dll",\
"api-ms-win-crt-runtime-l1-1-0.dll",\ "api-ms-win-crt-runtime-l1-1-0.dll",\
"api-ms-win-crt-stdio-l1-1-0.dll",\ "api-ms-win-crt-stdio-l1-1-0.dll",\
"api-ms-win-crt-string-l1-1-0.dll",\ "api-ms-win-crt-string-l1-1-0.dll",\
"api-ms-win-crt-time-l1-1-0.dll",\ "api-ms-win-crt-time-l1-1-0.dll",\
"api-ms-win-crt-utility-l1-1-0.dll",\ "api-ms-win-crt-utility-l1-1-0.dll",\
"ucrtbase.dll"] "ucrtbase.dll"]
delete_builddist = '' delete_builddist = ''
upx_enabled = '' upx_enabled = ''
package_universal_crt = '' package_universal_crt = ''
onefile = '' onefile = ''
windowed = '' windowed = ''
try: try:
print("This is a script to make building with Pyinstaller a bit more conventient.") print("This is a script to make building with Pyinstaller a bit more conventient.")
while (delete_builddist != 'y') and (delete_builddist != 'n'): while (delete_builddist != 'y') and (delete_builddist != 'n'):
delete_builddist = input("Delete build & dist folders? (Y/N): ").lower() delete_builddist = input("Delete build & dist folders? (Y/N): ").lower()
if delete_builddist == "y": if delete_builddist == "y":
try: try:
shutil.rmtree('dist') shutil.rmtree('dist')
except FileNotFoundError as e: except FileNotFoundError as e:
print(e) print(e)
try: try:
shutil.rmtree('build') shutil.rmtree('build')
except FileNotFoundError as e: except FileNotFoundError as e:
print(e) print(e)
while (upx_enabled != 'y') and (upx_enabled != 'n'): while (upx_enabled != 'y') and (upx_enabled != 'n'):
upx_enabled = input("Enable UPX? (Y/N): ").lower() upx_enabled = input("Enable UPX? (Y/N): ").lower()
if upx_enabled == 'y': if upx_enabled == 'y':
print("If upx is on your path you don't need to include anything here.") print("If upx is on your path you don't need to include anything here.")
if is_64bit == True: if is_64bit == True:
upx_dir = input("UPX directory [D:\\upx-3.96-win64]: ") upx_dir = input("UPX directory [D:\\upx-3.96-win64]: ")
if upx_dir == '': if upx_dir == '':
upx_dir = "D:\\upx-3.96-win64" # Default dir for me :) upx_dir = "D:\\upx-3.96-win64" # Default dir for me :)
else: else:
upx_dir = input("UPX directory [D:\\upx-3.96-win32]: ") upx_dir = input("UPX directory [D:\\upx-3.96-win32]: ")
if upx_dir == '': if upx_dir == '':
upx_dir = "D:\\upx-3.96-win32" # Default dir for me :) upx_dir = "D:\\upx-3.96-win32" # Default dir for me :)
print("upx_dir = " + upx_dir) print("upx_dir = " + upx_dir)
elif upx_enabled == 'n': elif upx_enabled == 'n':
upx_dir = '' upx_dir = ''
while (windowed != 'y') and (windowed != 'n'): while (windowed != 'y') and (windowed != 'n'):
windowed = input("Build with '--windowed'? (Y/N): ").lower() windowed = input("Build with '--windowed'? (Y/N): ").lower()
if sys.platform == 'win32': if sys.platform == 'win32':
print("(https://pyinstaller.readthedocs.io/en/stable/usage.html?highlight=sdk#windows)") print("(https://pyinstaller.readthedocs.io/en/stable/usage.html?highlight=sdk#windows)")
while (package_universal_crt != 'y') and (package_universal_crt != 'n'): while (package_universal_crt != 'y') and (package_universal_crt != 'n'):
package_universal_crt = input("Try to include universal CRT? (Y/N): ").lower() package_universal_crt = input("Try to include universal CRT? (Y/N): ").lower()
if package_universal_crt == 'y': if package_universal_crt == 'y':
if is_64bit == True: if is_64bit == True:
crt_path = input("Universal CRT: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64]: ") crt_path = input("Universal CRT: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64]: ")
if crt_path == '': if crt_path == '':
#crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64" # Default directory. #crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64" # Default directory.
crt_path = os.path.join('C:%s' % os.sep, 'Program Files (x86)', 'Windows Kits', '10', '10.0.19041.0', 'ucrt', 'DLLs', 'x64') crt_path = os.path.join('C:%s' % os.sep, 'Program Files (x86)', 'Windows Kits', '10', '10.0.19041.0', 'ucrt', 'DLLs', 'x64')
else: else:
crt_path = input("Extra path: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86]: ") crt_path = input("Extra path: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86]: ")
if crt_path == '': if crt_path == '':
#crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86" # Default directory. #crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86" # Default directory.
crt_path = os.path.join('C:%s' % os.sep, 'Program Files (x86)', 'Windows Kits', '10', '10.0.19041.0', 'ucrt', 'DLLs', 'x86') crt_path = os.path.join('C:%s' % os.sep, 'Program Files (x86)', 'Windows Kits', '10', '10.0.19041.0', 'ucrt', 'DLLs', 'x86')
print("crt_path = " + crt_path) print("crt_path = " + crt_path)
if (sys.platform == 'win32') or (sys.platform == 'linux'): if (sys.platform == 'win32') or (sys.platform == 'linux'):
while (onefile != 'y') and (onefile != 'n'): while (onefile != 'y') and (onefile != 'n'):
onefile = input("Build with '--onefile'? (Y/N): ").lower() onefile = input("Build with '--onefile'? (Y/N): ").lower()
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit("KeyboardInterrupt") sys.exit("KeyboardInterrupt")
#Windows #Windows
if sys.platform == 'win32': if sys.platform == 'win32':
run_win32 = [ run_win32 = [
'pesterchum.py', 'pesterchum.py',
'--name=Pesterchum', '--name=Pesterchum',
#'--noconfirm', # Overwrite output directory. #'--noconfirm', # Overwrite output directory.
#'--windowed', # Hide console #'--windowed', # Hide console
'--icon=pesterchum.ico', '--icon=pesterchum.ico',
'--clean', # Clear cache '--clean', # Clear cache
] ]
if (sys.version_info.major == 3) & (sys.version_info.minor == 8): if (sys.version_info.major == 3) & (sys.version_info.minor == 8):
exclude_modules.append('tkinter') exclude_modules.append('tkinter')
if upx_enabled == 'y': if upx_enabled == 'y':
if os.path.isdir(upx_dir): if os.path.isdir(upx_dir):
run_win32.append('--upx-dir=%s' % upx_dir) run_win32.append('--upx-dir=%s' % upx_dir)
for x in upx_exclude: for x in upx_exclude:
run_win32.append('--upx-exclude=%s' % x ) run_win32.append('--upx-exclude=%s' % x )
# Lower case variants are required. # Lower case variants are required.
run_win32.append('--upx-exclude=%s' % x.lower() ) run_win32.append('--upx-exclude=%s' % x.lower() )
elif upx_enabled == 'n': elif upx_enabled == 'n':
run_win32.append('--noupx') run_win32.append('--noupx')
for x in exclude_modules: for x in exclude_modules:
run_win32.append('--exclude-module=%s' % x ) run_win32.append('--exclude-module=%s' % x )
if windowed == 'y': if windowed == 'y':
run_win32.append('--windowed') run_win32.append('--windowed')
if onefile == 'y': if onefile == 'y':
run_win32.append('--onefile') run_win32.append('--onefile')
elif onefile == 'n': elif onefile == 'n':
for x in add_data: for x in add_data:
run_win32.append('--add-data=%s' % x ) run_win32.append('--add-data=%s' % x )
if package_universal_crt == 'y': if package_universal_crt == 'y':
run_win32.append('--paths=\"%s\"' % crt_path) run_win32.append('--paths=\"%s\"' % crt_path)
if os.path.exists(crt_path): if os.path.exists(crt_path):
if is_64bit == False: if is_64bit == False:
run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\API-MS-Win-core-xstate-l2-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\API-MS-Win-core-xstate-l2-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\ucrtbase.dll;.' % crt_path) run_win32.append('--add-binary=%s\\ucrtbase.dll;.' % crt_path)
elif is_64bit == True: elif is_64bit == True:
run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;.' % crt_path) run_win32.append('--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;.' % crt_path)
run_win32.append('--add-binary=%s\\ucrtbase.dll;.' % crt_path) run_win32.append('--add-binary=%s\\ucrtbase.dll;.' % crt_path)
print(run_win32) print(run_win32)
PyInstaller.__main__.run(run_win32) PyInstaller.__main__.run(run_win32)
if onefile == 'y': if onefile == 'y':
# There's more proper ways to do this, but this doesn't require changing our paths # There's more proper ways to do this, but this doesn't require changing our paths
for x in data_folders: for x in data_folders:
print(x) print(x)
shutil.copytree(x, os.path.join('dist', data_folders[x]), shutil.copytree(x, os.path.join('dist', data_folders[x]),
ignore=shutil.ignore_patterns('*.psd', ignore=shutil.ignore_patterns('*.psd',
'*.xcf*', '*.xcf*',
'ebg2.png', 'ebg2.png',
'ebg1.png')) 'ebg1.png'))
for x in data_files: for x in data_files:
print(x) print(x)
shutil.copy(x, os.path.join('dist', data_files[x])) shutil.copy(x, os.path.join('dist', data_files[x]))
files = os.listdir('dist') files = os.listdir('dist')
try: try:
os.mkdir(os.path.join('dist', 'Pesterchum')) os.mkdir(os.path.join('dist', 'Pesterchum'))
except FileExistsError: except FileExistsError:
pass pass
for x in files: for x in files:
shutil.move(os.path.join('dist',x), os.path.join('dist', 'Pesterchum')) shutil.move(os.path.join('dist',x), os.path.join('dist', 'Pesterchum'))
#shutil.copy(os.path.join('build', 'Pesterchum', 'xref-Pesterchum.html'), #shutil.copy(os.path.join('build', 'Pesterchum', 'xref-Pesterchum.html'),
# os.path.join('dist', 'Pesterchum', 'xref-Pesterchum.html')) # os.path.join('dist', 'Pesterchum', 'xref-Pesterchum.html'))
#shutil.copy(os.path.join('build', 'Pesterchum', 'Analysis-00.toc'), #shutil.copy(os.path.join('build', 'Pesterchum', 'Analysis-00.toc'),
# os.path.join('dist', 'Pesterchum', 'Analysis-00.toc')) # os.path.join('dist', 'Pesterchum', 'Analysis-00.toc'))
#MacOS #MacOS
elif sys.platform == 'darwin' : elif sys.platform == 'darwin' :
run_darwin =[ run_darwin =[
'pesterchum.py', 'pesterchum.py',
'--name=Pesterchum', '--name=Pesterchum',
#'--windowed', # Hide console #'--windowed', # Hide console
#'--noconfirm', # Overwrite output directory. #'--noconfirm', # Overwrite output directory.
'--icon=trayicon32.icns', # Icon '--icon=trayicon32.icns', # Icon
'--onedir', '--onedir',
'--clean', # Clear cache '--clean', # Clear cache
#'--noupx' #'--noupx'
] ]
if upx_enabled == 'y': if upx_enabled == 'y':
if os.path.isdir(upx_dir): if os.path.isdir(upx_dir):
run_darwin.append('--upx-dir=%s' % upx_dir) run_darwin.append('--upx-dir=%s' % upx_dir)
for x in upx_exclude: for x in upx_exclude:
run_darwin.append('--upx-exclude=%s' % x ) run_darwin.append('--upx-exclude=%s' % x )
# Lower case variants are required. # Lower case variants are required.
run_darwin.append('--upx-exclude=%s' % x.lower() ) run_darwin.append('--upx-exclude=%s' % x.lower() )
elif upx_enabled == 'n': elif upx_enabled == 'n':
run_darwin.append('--noupx') run_darwin.append('--noupx')
if os.path.isdir(upx_dir): if os.path.isdir(upx_dir):
run_darwin.append('--upx-dir=%s' % upx_dir) run_darwin.append('--upx-dir=%s' % upx_dir)
for x in exclude_modules: for x in exclude_modules:
run_darwin.append('--exclude-module=%s' % x ) run_darwin.append('--exclude-module=%s' % x )
for x in add_data: for x in add_data:
run_darwin.append('--add-data=%s' % x.replace(';',':') ) run_darwin.append('--add-data=%s' % x.replace(';',':') )
if windowed == 'y': if windowed == 'y':
run_darwin.append('--windowed') run_darwin.append('--windowed')
PyInstaller.__main__.run(run_darwin) PyInstaller.__main__.run(run_darwin)
#Linux #Linux
elif sys.platform == 'linux': elif sys.platform == 'linux':
run_linux =[ run_linux =[
'pesterchum.py', 'pesterchum.py',
'--name=Pesterchum', '--name=Pesterchum',
#'--windowed', # Hide console #'--windowed', # Hide console
#'--noconfirm', # Overwrite output directory. #'--noconfirm', # Overwrite output directory.
'--icon=trayicon32.icns', # Icon '--icon=trayicon32.icns', # Icon
'--clean', # Clear cache '--clean', # Clear cache
] ]
if upx_enabled == 'y': if upx_enabled == 'y':
if os.path.isdir(upx_dir): if os.path.isdir(upx_dir):
run_linux.append('--upx-dir=%s' % upx_dir) run_linux.append('--upx-dir=%s' % upx_dir)
for x in upx_exclude: for x in upx_exclude:
run_linux.append('--upx-exclude=%s' % x ) run_linux.append('--upx-exclude=%s' % x )
# Lower case variants are required. # Lower case variants are required.
run_linux.append('--upx-exclude=%s' % x.lower() ) run_linux.append('--upx-exclude=%s' % x.lower() )
elif upx_enabled == 'n': elif upx_enabled == 'n':
run_linux.append('--noupx') run_linux.append('--noupx')
for x in exclude_modules: for x in exclude_modules:
run_linux.append('--exclude-module=%s' % x ) run_linux.append('--exclude-module=%s' % x )
if onefile == 'y': if onefile == 'y':
run_linux.append('--onefile') run_linux.append('--onefile')
elif onefile == 'n': elif onefile == 'n':
for x in add_data: for x in add_data:
run_linux.append('--add-data=%s' % x.replace(';',':') ) run_linux.append('--add-data=%s' % x.replace(';',':') )
if windowed == 'y': if windowed == 'y':
run_linux.append('--windowed') run_linux.append('--windowed')
print(run_linux) print(run_linux)
PyInstaller.__main__.run(run_linux) PyInstaller.__main__.run(run_linux)
if onefile == 'y': if onefile == 'y':
# There's more proper ways to do this, but this doesn't require changing our paths # There's more proper ways to do this, but this doesn't require changing our paths
for x in data_folders: for x in data_folders:
print(x) print(x)
shutil.copytree(x, os.path.join('dist', data_folders[x]), shutil.copytree(x, os.path.join('dist', data_folders[x]),
ignore=shutil.ignore_patterns('*.psd', ignore=shutil.ignore_patterns('*.psd',
'*.xcf*', '*.xcf*',
'ebg2.png', 'ebg2.png',
'ebg1.png')) 'ebg1.png'))
for x in data_files_linux: for x in data_files_linux:
print(x) print(x)
shutil.copy(x, os.path.join('dist', data_files_linux[x])) shutil.copy(x, os.path.join('dist', data_files_linux[x]))
files = os.listdir('dist') files = os.listdir('dist')
try: try:
os.mkdir(os.path.join('dist', '.cache')) os.mkdir(os.path.join('dist', '.cache'))
except FileExistsError as e: except FileExistsError as e:
print(e) print(e)
for x in files: for x in files:
try: try:
shutil.move(os.path.join('dist',x), os.path.join('dist', '.cache', x)) shutil.move(os.path.join('dist',x), os.path.join('dist', '.cache', x))
except FileExistsError as e: except FileExistsError as e:
print(e) print(e)
shutil.move(os.path.join('dist', '.cache'), os.path.join('dist', 'Pesterchum')) shutil.move(os.path.join('dist', '.cache'), os.path.join('dist', 'Pesterchum'))
#shutil.copy(os.path.join('build', 'Pesterchum', 'xref-Pesterchum.html'), #shutil.copy(os.path.join('build', 'Pesterchum', 'xref-Pesterchum.html'),
# os.path.join('dist', 'Pesterchum', 'xref-Pesterchum.html')) # os.path.join('dist', 'Pesterchum', 'xref-Pesterchum.html'))
#shutil.copy(os.path.join('build', 'Pesterchum', 'Analysis-00.toc'), #shutil.copy(os.path.join('build', 'Pesterchum', 'Analysis-00.toc'),
# os.path.join('dist', 'Pesterchum', 'Analysis-00.toc')) # os.path.join('dist', 'Pesterchum', 'Analysis-00.toc'))
else: else:
print("Unknown platform.") print("Unknown platform.")
run_generic =[ run_generic =[
'pesterchum.py', 'pesterchum.py',
'--name=Pesterchum' '--name=Pesterchum'
'--clean', # Clear cache '--clean', # Clear cache
] ]
if upx_enabled == 'y': if upx_enabled == 'y':
if os.path.isdir(upx_dir): if os.path.isdir(upx_dir):
run_generic.append('--upx-dir=%s' % upx_dir) run_generic.append('--upx-dir=%s' % upx_dir)
else: else:
run_generic.append('--noupx') run_generic.append('--noupx')
for x in upx_exclude: for x in upx_exclude:
run_generic.append('--upx-exclude=%s' % x ) run_generic.append('--upx-exclude=%s' % x )
# Lower case variants are required. # Lower case variants are required.
run_generic.append('--upx-exclude=%s' % x.lower() ) run_generic.append('--upx-exclude=%s' % x.lower() )
for x in exclude_modules: for x in exclude_modules:
run_generic.append('--exclude-module=%s' % x ) run_generic.append('--exclude-module=%s' % x )
for x in add_data: for x in add_data:
run_generic.append('--add-data=%s' % x.replace(';',':') ) run_generic.append('--add-data=%s' % x.replace(';',':') )
if windowed == 'y': if windowed == 'y':
run_win32.append('--windowed') run_win32.append('--windowed')
print(run_generic) print(run_generic)
PyInstaller.__main__.run(run_generic) PyInstaller.__main__.run(run_generic)

View file

@ -2,7 +2,7 @@ import logging
import logging.config import logging.config
import importlib.util import importlib.util
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import ostools import ostools
from quirks import ScriptQuirks from quirks import ScriptQuirks
@ -51,7 +51,7 @@ class PythonQuirks(ScriptQuirks):
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
msgbox.setWindowTitle("Error!") msgbox.setWindowTitle("Error!")
msgbox.setText("Quirk malformed: %s" % (obj.command)) msgbox.setText("Quirk malformed: %s" % (obj.command))
msgbox.exec_() msgbox.exec()
else: else:
self.quirks[obj.command] = obj self.quirks[obj.command] = obj

View file

@ -78,7 +78,7 @@ class ScriptQuirks(object):
#msgbox = QtWidgets.QMessageBox() #msgbox = QtWidgets.QMessageBox()
#msgbox.setWindowTitle("Error!") #msgbox.setWindowTitle("Error!")
#msgbox.setText("Error loading %s: %s (in quirks.py)" % (os.path.basename(filename), e)) #msgbox.setText("Error loading %s: %s (in quirks.py)" % (os.path.basename(filename), e))
#msgbox.exec_() #msgbox.exec()
else: else:
if self.modHas(module, 'setup'): if self.modHas(module, 'setup'):
module.setup() module.setup()

View file

@ -1,7 +1,7 @@
import logging import logging
import logging.config import logging.config
from PyQt5 import QtCore, QtWidgets from PyQt6 import QtCore, QtWidgets
import ostools import ostools
@ -70,7 +70,7 @@ class RandomHandler(QtCore.QObject):
msgbox = QtWidgets.QMessageBox() msgbox = QtWidgets.QMessageBox()
msgbox.setText("Unable to fetch you a random encounter!") msgbox.setText("Unable to fetch you a random encounter!")
msgbox.setInformativeText("Try again later :(") msgbox.setInformativeText("Try again later :(")
msgbox.exec_() msgbox.exec()
return return
name = str(l[1]) name = str(l[1])
PchumLog.info("Random Encounter name is: " + name) PchumLog.info("Random Encounter name is: " + name)

276
setup.py
View file

@ -1,138 +1,138 @@
# Windows-only cx_freeze setup file, macOS may work but I've not tested it. # Windows-only cx_freeze setup file, macOS may work but I've not tested it.
import sys import sys
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
import pygame import pygame
from version import buildVersion from version import buildVersion
if sys.version_info < (3, 0, 0): if sys.version_info < (3, 0, 0):
sys.exit("Python versions lower than 3 are not supported.") sys.exit("Python versions lower than 3 are not supported.")
def is_64bit() -> bool: def is_64bit() -> bool:
return sys.maxsize > 2**32 return sys.maxsize > 2**32
path = "" path = ""
base = None base = None
if sys.platform == "win32": if sys.platform == "win32":
base = "Win32GUI" base = "Win32GUI"
path = sys.path path = sys.path
if is_64bit() == True: if is_64bit() == True:
path.append(r"C:\Program Files (x86)\Windows Kits\10\Redist\10.0.22000.0\ucrt\DLLs\x64") path.append(r"C:\Program Files (x86)\Windows Kits\10\Redist\10.0.22000.0\ucrt\DLLs\x64")
elif is_64bit() == False: elif is_64bit() == False:
path.append(r"C:\Program Files (x86)\Windows Kits\10\Redist\10.0.22000.0\ucrt\DLLs\x86") path.append(r"C:\Program Files (x86)\Windows Kits\10\Redist\10.0.22000.0\ucrt\DLLs\x86")
print("Path = " + str(path)) print("Path = " + str(path))
includefiles = ["quirks", includefiles = ["quirks",
"smilies", "smilies",
"themes", "themes",
"docs", "docs",
"README.md", "README.md",
"LICENSE", "LICENSE",
"CHANGELOG.md", "CHANGELOG.md",
"PCskins.png", "PCskins.png",
"Pesterchum.png"] "Pesterchum.png"]
build_exe_options = { build_exe_options = {
"includes": ['PyQt5.QtCore', "includes": ['PyQt6.QtCore',
'PyQt5.QtGui', 'PyQt6.QtGui',
'PyQt5.QtWidgets'], 'PyQt6.QtWidgets'],
"excludes": ['collections.sys', "excludes": ['collections.sys',
'collections._sre', 'collections._sre',
'collections._json', 'collections._json',
'collections._locale', 'collections._locale',
'collections._struct', 'collections._struct',
'collections.array', 'collections.array',
'collections._weakref', 'collections._weakref',
'PyQt5.QtMultimedia', 'PyQt6.QtMultimedia',
'PyQt5.QtDBus', 'PyQt6.QtDBus',
'PyQt5.QtDeclarative', 'PyQt6.QtDeclarative',
'PyQt5.QtHelp', 'PyQt6.QtHelp',
'PyQt5.QtNetwork', 'PyQt6.QtNetwork',
'PyQt5.QtSql', 'PyQt6.QtSql',
'PyQt5.QtSvg', 'PyQt6.QtSvg',
'PyQt5.QtTest', 'PyQt6.QtTest',
'PyQt5.QtWebKit', 'PyQt6.QtWebKit',
'PyQt5.QtXml', 'PyQt6.QtXml',
'PyQt5.QtXmlPatterns', 'PyQt6.QtXmlPatterns',
'PyQt5.phonon', 'PyQt6.phonon',
'PyQt5.QtAssistant', 'PyQt6.QtAssistant',
'PyQt5.QtDesigner', 'PyQt6.QtDesigner',
'PyQt5.QAxContainer', 'PyQt6.QAxContainer',
'pygame.docs' # Hopefully we can just not have pygame at all at some point =3 'pygame.docs' # Hopefully we can just not have pygame at all at some point =3
# (when QtMultimedia stops relying on local codecs </3) # (when QtMultimedia stops relying on local codecs </3)
'pygame.examples', 'pygame.examples',
'pygame.tests', 'pygame.tests',
'pydoc_data'], 'pydoc_data'],
"include_files": includefiles, "include_files": includefiles,
"include_msvcr": True, # cx_freeze copies 64-bit binaries always? "include_msvcr": True, # cx_freeze copies 64-bit binaries always?
"path": path # Improved in 6.6, path to be safe "path": path # Improved in 6.6, path to be safe
# VCRUNTIME140.dll <3 # VCRUNTIME140.dll <3
} }
if (sys.platform == 'win32') & (sys.version_info.major == 3) & (sys.version_info.minor == 8): if (sys.platform == 'win32') & (sys.version_info.major == 3) & (sys.version_info.minor == 8):
build_exe_options["excludes"].append('tkinter') build_exe_options["excludes"].append('tkinter')
bdist_mac_options = { bdist_mac_options = {
'iconfile': 'trayicon32.icns', 'iconfile': 'trayicon32.icns',
'bundle_name': "Pesterchum" 'bundle_name': "Pesterchum"
} }
description = "Pesterchum" description = "Pesterchum"
icon = "pesterchum.ico" icon = "pesterchum.ico"
# See https://stackoverflow.com/questions/15734703/use-cx-freeze-to-create-an-msi-that-adds-a-shortcut-to-the-desktop # See https://stackoverflow.com/questions/15734703/use-cx-freeze-to-create-an-msi-that-adds-a-shortcut-to-the-desktop
shortcut_table = [ shortcut_table = [
("DesktopShortcut", # Shortcut ("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_ "DesktopFolder", # Directory_
"Pesterchum", # Name "Pesterchum", # Name
"TARGETDIR", # Component_ "TARGETDIR", # Component_
"[TARGETDIR]pesterchum.exe",# Target "[TARGETDIR]pesterchum.exe",# Target
None, # Arguments None, # Arguments
description, # Description description, # Description
None, # Hotkey None, # Hotkey
None, # Icon (Is inherited from pesterchum.exe) None, # Icon (Is inherited from pesterchum.exe)
None, # IconIndex None, # IconIndex
None, # ShowCmd None, # ShowCmd
'TARGETDIR' # WkDir 'TARGETDIR' # WkDir
), ),
("StartMenuShortcut", # Shortcut ("StartMenuShortcut", # Shortcut
"StartMenuFolder", # Directory_ "StartMenuFolder", # Directory_
"Pesterchum", # Name "Pesterchum", # Name
"TARGETDIR", # Component_ "TARGETDIR", # Component_
"[TARGETDIR]pesterchum.exe",# Target "[TARGETDIR]pesterchum.exe",# Target
None, # Arguments None, # Arguments
description, # Description description, # Description
None, # Hotkey None, # Hotkey
None, # Icon None, # Icon
None, # IconIndex None, # IconIndex
None, # ShowCmd None, # ShowCmd
'TARGETDIR' # WkDir 'TARGETDIR' # WkDir
) )
] ]
msi_data = {"Shortcut": shortcut_table} msi_data = {"Shortcut": shortcut_table}
bdist_msi_options = {'data': msi_data, bdist_msi_options = {'data': msi_data,
'summary_data': { 'summary_data': {
'comments': "FL1P", 'comments': "FL1P",
'keywords': "Pesterchum"}, 'keywords': "Pesterchum"},
'upgrade_code': "{86740d75-f1f2-48e8-8266-f36395a2d77f}", 'upgrade_code': "{86740d75-f1f2-48e8-8266-f36395a2d77f}",
'add_to_path': False, # !!! 'add_to_path': False, # !!!
'all_users': False, 'all_users': False,
'install_icon': "pesterchum.ico"} 'install_icon': "pesterchum.ico"}
setup( setup(
name = "Pesterchum", name = "Pesterchum",
version = buildVersion, version = buildVersion,
url = "https://github.com/Dpeta/pesterchum-alt-servers", url = "https://github.com/Dpeta/pesterchum-alt-servers",
description = description,#"P3ST3RCHUM", description = description,#"P3ST3RCHUM",
options = {"build_exe": build_exe_options, options = {"build_exe": build_exe_options,
"bdist_msi": bdist_msi_options, "bdist_msi": bdist_msi_options,
"bdist_mac": bdist_mac_options}, "bdist_mac": bdist_mac_options},
packages="", packages="",
executables = [Executable("pesterchum.py", executables = [Executable("pesterchum.py",
base=base, base=base,
icon=icon icon=icon
)]) )])

View file

@ -4,7 +4,7 @@ import inspect
import logging import logging
import logging.config import logging.config
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import ostools import ostools
@ -197,19 +197,19 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
self.time = time self.time = time
if ostools.isWin32(): if ostools.isWin32():
self.setWindowFlags(QtCore.Qt.ToolTip) self.setWindowFlags(QtCore.Qt.WindowType.ToolTip)
else: else:
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.X11BypassWindowManagerHint | QtCore.Qt.ToolTip) self.setWindowFlags(QtCore.Qt.WindowType.WindowStaysOnTopHint | QtCore.Qt.WindowType.X11BypassWindowManagerHint | QtCore.Qt.WindowType.ToolTip)
self.m_animation = QtCore.QParallelAnimationGroup() self.m_animation = QtCore.QParallelAnimationGroup()
anim = QtCore.QPropertyAnimation(self) anim = QtCore.QPropertyAnimation(self)
anim.setTargetObject(self) anim.setTargetObject(self)
self.m_animation.addAnimation(anim) self.m_animation.addAnimation(anim)
anim.setEasingCurve(QtCore.QEasingCurve.OutBounce) anim.setEasingCurve(QtCore.QEasingCurve.Type.OutBounce)
anim.setDuration(1000) anim.setDuration(1000)
anim.finished.connect(self.reverseTrigger) anim.finished.connect(self.reverseTrigger)
self.m_animation.setDirection(QtCore.QAnimationGroup.Forward) self.m_animation.setDirection(QtCore.QAbstractAnimation.Direction.Forward)
self.title = QtWidgets.QLabel(title, self) self.title = QtWidgets.QLabel(title, self)
self.msg = QtWidgets.QLabel(msg, self) self.msg = QtWidgets.QLabel(msg, self)
@ -230,7 +230,7 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
layout_1 = QtWidgets.QGridLayout() layout_1 = QtWidgets.QGridLayout()
layout_1.addWidget(self.icon, 0,0, 1,1) layout_1.addWidget(self.icon, 0,0, 1,1)
layout_1.addWidget(self.title, 0,1, 1,7) layout_1.addWidget(self.title, 0,1, 1,7)
layout_1.setAlignment(self.msg, QtCore.Qt.AlignTop) layout_1.setAlignment(self.msg, QtCore.Qt.AlignmentFlag.AlignTop)
layout_0.addLayout(layout_1) layout_0.addLayout(layout_1)
else: else:
layout_0.addWidget(self.title) layout_0.addWidget(self.title)
@ -252,11 +252,13 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
self.msg.setText(PesterToast.wrapText(self.msg.font(), str(self.msg.text()), self.parent().theme["toasts/width"], self.parent().theme["toasts/content/style"])) self.msg.setText(PesterToast.wrapText(self.msg.font(), str(self.msg.text()), self.parent().theme["toasts/width"], self.parent().theme["toasts/content/style"]))
p = QtWidgets.QApplication.desktop().availableGeometry(self).bottomRight() for screen in QtWidgets.QApplication.screens():
o = QtWidgets.QApplication.desktop().screenGeometry(self).bottomRight() # This 100% doesn't work with multiple screens.
anim.setStartValue(p.y() - o.y()) p = screen.availableGeometry().bottomRight()
anim.setEndValue(100) o = screen.geometry().bottomRight()
anim.valueChanged[QtCore.QVariant].connect(self.updateBottomLeftAnimation) anim.setStartValue(p.y() - o.y())
anim.setEndValue(100)
anim.valueChanged[QtCore.QVariant].connect(self.updateBottomLeftAnimation)
self.byebye = False self.byebye = False
@ -286,15 +288,17 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
if not self.byebye: if not self.byebye:
self.byebye = True self.byebye = True
anim = self.m_animation.animationAt(0) anim = self.m_animation.animationAt(0)
self.m_animation.setDirection(QtCore.QAnimationGroup.Backward) self.m_animation.setDirection(QtCore.QAbstractAnimation.Direction.Backward)
anim.setEasingCurve(QtCore.QEasingCurve.InCubic) anim.setEasingCurve(QtCore.QEasingCurve.Type.InCubic)
anim.finished.disconnect(self.reverseTrigger) anim.finished.disconnect(self.reverseTrigger)
anim.finished.connect(self.done) anim.finished.connect(self.done)
self.m_animation.start() self.m_animation.start()
@QtCore.pyqtSlot(QtCore.QVariant) @QtCore.pyqtSlot(QtCore.QVariant)
def updateBottomLeftAnimation(self, value): def updateBottomLeftAnimation(self, value):
p = QtWidgets.QApplication.desktop().availableGeometry(self).bottomRight() #p = QtWidgets.QApplication.desktop().availableGeometry(self).bottomRight()
for screen in QtWidgets.QApplication.screens():
p = screen.availableGeometry().bottomRight()
val = (self.height())/100 val = (self.height())/100
# Does type casting this to an int have any negative consequences? # Does type casting this to an int have any negative consequences?
self.move(int(p.x()-self.width()), int(p.y() - (value * val) +1)) self.move(int(p.x()-self.width()), int(p.y() - (value * val) +1))
@ -302,9 +306,9 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
QtWidgets.QWidget.show(self) QtWidgets.QWidget.show(self)
def mousePressEvent(self, event): def mousePressEvent(self, event):
if event.button() == QtCore.Qt.RightButton: if event.button() == QtCore.Qt.MouseButton.RightButton:
self.reverseStart() self.reverseStart()
elif event.button() == QtCore.Qt.LeftButton: elif event.button() == QtCore.Qt.MouseButton.LeftButton:
pass pass
@staticmethod @staticmethod
@ -351,20 +355,20 @@ class PesterToast(QtWidgets.QWidget, DefaultToast):
if stuff.isdigit(): if stuff.isdigit():
maxwidth -= int(stuff) maxwidth -= int(stuff)
if metric.width(text) < maxwidth: if metric.horizontalAdvance(text) < maxwidth:
return text return text
while metric.width(text) > maxwidth: while metric.horizontalAdvance(text) > maxwidth:
lastspace = text.find(" ") lastspace = text.find(" ")
curspace = lastspace curspace = lastspace
while metric.width(text, curspace) < maxwidth: while metric.horizontalAdvance(text, curspace) < maxwidth:
lastspace = curspace lastspace = curspace
curspace = text.find(" ", lastspace+1) curspace = text.find(" ", lastspace+1)
if curspace == -1: if curspace == -1:
break break
if (metric.width(text[:lastspace]) > maxwidth) or \ if (metric.horizontalAdvance(text[:lastspace]) > maxwidth) or \
len(text[:lastspace]) < 1: len(text[:lastspace]) < 1:
for i in range(len(text)): for i in range(len(text)):
if metric.width(text[:i]) > maxwidth: if metric.horizontalAdvance(text[:i]) > maxwidth:
lastspace = i-1 lastspace = i-1
break break
ret.append(text[:lastspace]) ret.append(text[:lastspace])