Cleanup and type realignment. I'll be working on adjusting the Pester/Memo frames.
This commit is contained in:
parent
0cb3a74f1f
commit
951c6681fa
3 changed files with 39 additions and 21 deletions
7
convo.py
7
convo.py
|
@ -253,7 +253,7 @@ class PesterTabWindow(QtGui.QFrame):
|
||||||
|
|
||||||
class PesterMovie(QtGui.QMovie):
|
class PesterMovie(QtGui.QMovie):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QtGui.QMovie.__init__(self, parent)
|
super(PesterMovie, self).__init__(parent)
|
||||||
self.textwindow = parent
|
self.textwindow = parent
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
def animate(self, frame):
|
def animate(self, frame):
|
||||||
|
@ -515,11 +515,12 @@ class PesterText(QtGui.QTextEdit):
|
||||||
del self.sending
|
del self.sending
|
||||||
|
|
||||||
class PesterInput(QtGui.QLineEdit):
|
class PesterInput(QtGui.QLineEdit):
|
||||||
|
stylesheet_path = "convo/input/style"
|
||||||
def __init__(self, theme, parent=None):
|
def __init__(self, theme, parent=None):
|
||||||
super(PesterInput, self).__init__(parent)
|
super(PesterInput, self).__init__(parent)
|
||||||
self.setStyleSheet(theme["convo/input/style"])
|
self.changeTheme(theme)
|
||||||
def changeTheme(self, theme):
|
def changeTheme(self, theme):
|
||||||
self.setStyleSheet(theme["convo/input/style"])
|
self.setStyleSheet(theme[self.stylesheet_path])
|
||||||
def focusInEvent(self, event):
|
def focusInEvent(self, event):
|
||||||
self.parent().clearNewMessage()
|
self.parent().clearNewMessage()
|
||||||
self.parent().textArea.textCursor().clearSelection()
|
self.parent().textArea.textCursor().clearSelection()
|
||||||
|
|
19
memos.py
19
memos.py
|
@ -181,7 +181,7 @@ class TimeTracker(list):
|
||||||
|
|
||||||
class TimeInput(QtGui.QLineEdit):
|
class TimeInput(QtGui.QLineEdit):
|
||||||
def __init__(self, timeslider, parent):
|
def __init__(self, timeslider, parent):
|
||||||
QtGui.QLineEdit.__init__(self, parent)
|
super(TimeInput, self).__init__(parent)
|
||||||
self.timeslider = timeslider
|
self.timeslider = timeslider
|
||||||
self.setText("+0:00")
|
self.setText("+0:00")
|
||||||
self.connect(self.timeslider, QtCore.SIGNAL('valueChanged(int)'),
|
self.connect(self.timeslider, QtCore.SIGNAL('valueChanged(int)'),
|
||||||
|
@ -212,7 +212,7 @@ class TimeInput(QtGui.QLineEdit):
|
||||||
|
|
||||||
class TimeSlider(QtGui.QSlider):
|
class TimeSlider(QtGui.QSlider):
|
||||||
def __init__(self, orientation, parent):
|
def __init__(self, orientation, parent):
|
||||||
QtGui.QSlider.__init__(self, orientation, parent)
|
super(TimeSlider, self).__init__(orientation, parent)
|
||||||
self.setTracking(True)
|
self.setTracking(True)
|
||||||
self.setMinimum(-50)
|
self.setMinimum(-50)
|
||||||
self.setMaximum(50)
|
self.setMaximum(50)
|
||||||
|
@ -227,7 +227,7 @@ class TimeSlider(QtGui.QSlider):
|
||||||
|
|
||||||
class MemoTabWindow(PesterTabWindow):
|
class MemoTabWindow(PesterTabWindow):
|
||||||
def __init__(self, mainwindow, parent=None):
|
def __init__(self, mainwindow, parent=None):
|
||||||
PesterTabWindow.__init__(self, mainwindow, parent, "memos")
|
super(MemoTabWindow, self).__init__(mainwindow, parent, "memos")
|
||||||
def addChat(self, convo):
|
def addChat(self, convo):
|
||||||
self.convos[convo.channel] = convo
|
self.convos[convo.channel] = convo
|
||||||
# either addTab or setCurrentIndex will trigger changed()
|
# either addTab or setCurrentIndex will trigger changed()
|
||||||
|
@ -244,7 +244,7 @@ _ctag_begin = re.compile(r'<c=(.*?)>')
|
||||||
|
|
||||||
class MemoText(PesterText):
|
class MemoText(PesterText):
|
||||||
def __init__(self, theme, parent=None):
|
def __init__(self, theme, parent=None):
|
||||||
QtGui.QTextEdit.__init__(self, parent)
|
super(MemoText, self).__init__(parent)
|
||||||
if hasattr(self.parent(), 'mainwindow'):
|
if hasattr(self.parent(), 'mainwindow'):
|
||||||
self.mainwindow = self.parent().mainwindow
|
self.mainwindow = self.parent().mainwindow
|
||||||
else:
|
else:
|
||||||
|
@ -343,13 +343,14 @@ class MemoText(PesterText):
|
||||||
return "[%s]" % (self.parent().title())
|
return "[%s]" % (self.parent().title())
|
||||||
|
|
||||||
class MemoInput(PesterInput):
|
class MemoInput(PesterInput):
|
||||||
def __init__(self, theme, parent=None):
|
stylesheet_path = "memos/input/style"
|
||||||
QtGui.QLineEdit.__init__(self, parent)
|
# karxi: Because of the use of stylesheet_path, we don't have to rewrite
|
||||||
self.setStyleSheet(theme["memos/input/style"])
|
# this code.
|
||||||
def changeTheme(self, theme):
|
# Neat, huh?
|
||||||
self.setStyleSheet(theme["memos/input/style"])
|
pass # So vim recognizes the end of this class
|
||||||
|
|
||||||
class PesterMemo(PesterConvo):
|
class PesterMemo(PesterConvo):
|
||||||
|
# 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):
|
||||||
QtGui.QFrame.__init__(self, parent)
|
QtGui.QFrame.__init__(self, parent)
|
||||||
self.setAttribute(QtCore.Qt.WA_QuitOnClose, False)
|
self.setAttribute(QtCore.Qt.WA_QuitOnClose, False)
|
||||||
|
|
|
@ -125,6 +125,11 @@ CUSTOMBOTS = ["CALSPRITE", RANDNICK.upper()]
|
||||||
BOTNAMES = ["NICKSERV", "CHANSERV", "MEMOSERV", "OPERSERV", "HELPSERV"]
|
BOTNAMES = ["NICKSERV", "CHANSERV", "MEMOSERV", "OPERSERV", "HELPSERV"]
|
||||||
BOTNAMES.extend(CUSTOMBOTS)
|
BOTNAMES.extend(CUSTOMBOTS)
|
||||||
|
|
||||||
|
# Save the main app. From here, we should be able to get everything else in
|
||||||
|
# order, for console use.
|
||||||
|
_CONSOLE_ENV = AttrDict()
|
||||||
|
_CONSOLE_ENV.PAPP = None
|
||||||
|
|
||||||
|
|
||||||
class waitingMessageHolder(object):
|
class waitingMessageHolder(object):
|
||||||
def __init__(self, mainwindow, **msgfuncs):
|
def __init__(self, mainwindow, **msgfuncs):
|
||||||
|
@ -156,7 +161,7 @@ class waitingMessageHolder(object):
|
||||||
|
|
||||||
class chumListing(QtGui.QTreeWidgetItem):
|
class chumListing(QtGui.QTreeWidgetItem):
|
||||||
def __init__(self, chum, window):
|
def __init__(self, chum, window):
|
||||||
QtGui.QTreeWidgetItem.__init__(self, [chum.handle])
|
super(chumListing, self).__init__([chum.handle])
|
||||||
self.mainwindow = window
|
self.mainwindow = window
|
||||||
self.chum = chum
|
self.chum = chum
|
||||||
self.handle = chum.handle
|
self.handle = chum.handle
|
||||||
|
@ -234,8 +239,10 @@ class chumListing(QtGui.QTreeWidgetItem):
|
||||||
return (h1 < h2)
|
return (h1 < h2)
|
||||||
|
|
||||||
class chumArea(RightClickTree):
|
class chumArea(RightClickTree):
|
||||||
|
# This is the class that controls the actual main chumlist, I think.
|
||||||
|
# Looking into how the groups work might be wise.
|
||||||
def __init__(self, chums, parent=None):
|
def __init__(self, chums, parent=None):
|
||||||
QtGui.QTreeWidget.__init__(self, parent)
|
super(chumArea, self).__init__(parent)
|
||||||
self.notify = False
|
self.notify = False
|
||||||
QtCore.QTimer.singleShot(30000, self, QtCore.SLOT('beginNotify()'))
|
QtCore.QTimer.singleShot(30000, self, QtCore.SLOT('beginNotify()'))
|
||||||
self.mainwindow = parent
|
self.mainwindow = parent
|
||||||
|
@ -881,7 +888,7 @@ class chumArea(RightClickTree):
|
||||||
|
|
||||||
class trollSlum(chumArea):
|
class trollSlum(chumArea):
|
||||||
def __init__(self, trolls, mainwindow, parent=None):
|
def __init__(self, trolls, mainwindow, parent=None):
|
||||||
QtGui.QListWidget.__init__(self, parent)
|
super(trollSlum, self).__init__(parent)
|
||||||
self.mainwindow = mainwindow
|
self.mainwindow = mainwindow
|
||||||
theme = self.mainwindow.theme
|
theme = self.mainwindow.theme
|
||||||
self.setStyleSheet(theme["main/trollslum/chumroll/style"])
|
self.setStyleSheet(theme["main/trollslum/chumroll/style"])
|
||||||
|
@ -927,7 +934,7 @@ class trollSlum(chumArea):
|
||||||
|
|
||||||
class TrollSlumWindow(QtGui.QFrame):
|
class TrollSlumWindow(QtGui.QFrame):
|
||||||
def __init__(self, trolls, mainwindow, parent=None):
|
def __init__(self, trolls, mainwindow, parent=None):
|
||||||
QtGui.QFrame.__init__(self, parent)
|
super(TrollSlumWindow, self).__init__(parent)
|
||||||
self.mainwindow = mainwindow
|
self.mainwindow = mainwindow
|
||||||
theme = self.mainwindow.theme
|
theme = self.mainwindow.theme
|
||||||
self.slumlabel = QtGui.QLabel(self)
|
self.slumlabel = QtGui.QLabel(self)
|
||||||
|
@ -1004,13 +1011,22 @@ class TrollSlumWindow(QtGui.QFrame):
|
||||||
|
|
||||||
class PesterWindow(MovingWindow):
|
class PesterWindow(MovingWindow):
|
||||||
def __init__(self, options, parent=None, app=None):
|
def __init__(self, options, parent=None, app=None):
|
||||||
MovingWindow.__init__(self, parent,
|
super(PesterWindow, self).__init__(parent,
|
||||||
(QtCore.Qt.CustomizeWindowHint |
|
(QtCore.Qt.CustomizeWindowHint |
|
||||||
QtCore.Qt.FramelessWindowHint))
|
QtCore.Qt.FramelessWindowHint))
|
||||||
|
|
||||||
# For debugging
|
# For debugging
|
||||||
global PESTERAPP
|
_CONSOLE_ENV.PAPP = self
|
||||||
PESTERAPP = app
|
# TODO: karxi: SO! At the end of this function it seems like that
|
||||||
|
# object is just made into None or.../something/. Somehow, it just
|
||||||
|
# DIES, and I haven't the slightest idea why. I've tried multiple ways
|
||||||
|
# to set it that shouldn't cause issues with globals; I honestly don't
|
||||||
|
# know what to do.
|
||||||
|
# Putting logging statements in here *gives me an object*, but I can't
|
||||||
|
# carry it out of the function. I'll hvae to think of a way around
|
||||||
|
# this....
|
||||||
|
# If I use a definition made in here without having another elsewhere,
|
||||||
|
# it comes back as undefined. Just...what?
|
||||||
|
|
||||||
self.autoJoinDone = False
|
self.autoJoinDone = False
|
||||||
self.app = app
|
self.app = app
|
||||||
|
@ -2857,7 +2873,7 @@ class PesterWindow(MovingWindow):
|
||||||
|
|
||||||
class PesterTray(QtGui.QSystemTrayIcon):
|
class PesterTray(QtGui.QSystemTrayIcon):
|
||||||
def __init__(self, icon, mainwindow, parent):
|
def __init__(self, icon, mainwindow, parent):
|
||||||
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
|
super(PesterTray, self).__init__(icon, parent)
|
||||||
self.mainwindow = mainwindow
|
self.mainwindow = mainwindow
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
|
@ -2872,7 +2888,7 @@ class PesterTray(QtGui.QSystemTrayIcon):
|
||||||
|
|
||||||
class MainProgram(QtCore.QObject):
|
class MainProgram(QtCore.QObject):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QtCore.QObject.__init__(self)
|
super(MainProgram, self).__init__()
|
||||||
self.app = QtGui.QApplication(sys.argv)
|
self.app = QtGui.QApplication(sys.argv)
|
||||||
self.app.setApplicationName("Pesterchum 3.14")
|
self.app.setApplicationName("Pesterchum 3.14")
|
||||||
self.app.setQuitOnLastWindowClosed(False)
|
self.app.setQuitOnLastWindowClosed(False)
|
||||||
|
|
Loading…
Reference in a new issue