This commit is contained in:
Stephen Dranger 2011-02-09 00:26:23 -06:00
parent 3c16004844
commit 547fdb71b4
24 changed files with 92 additions and 39 deletions

2
TODO
View file

@ -1,7 +1,5 @@
Features: Features:
* Tray doesn't disappear on windows after close * Tray doesn't disappear on windows after close
* comment history (up button)
* page up/down scrolling
* System tray menu * System tray menu
* troll colors * troll colors
* ctrl-tab should prefer new convos * ctrl-tab should prefer new convos

View file

@ -2,7 +2,7 @@ from string import Template
import re import re
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from dataobjs import PesterProfile, Mood from dataobjs import PesterProfile, Mood, PesterHistory
from generic import PesterIcon, RightClickList from generic import PesterIcon, RightClickList
from parsetools import escapeBrackets, convertTags from parsetools import escapeBrackets, convertTags
@ -277,6 +277,20 @@ class PesterInput(QtGui.QLineEdit):
def focusInEvent(self, event): def focusInEvent(self, event):
self.parent().clearNewMessage() self.parent().clearNewMessage()
QtGui.QLineEdit.focusInEvent(self, event) QtGui.QLineEdit.focusInEvent(self, event)
def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Up:
text = unicode(self.text())
next = self.parent().history.next(text)
if next is not None:
self.setText(next)
elif event.key() == QtCore.Qt.Key_Down:
prev = self.parent().history.prev()
if prev is not None:
self.setText(prev)
elif event.key() in [QtCore.Qt.Key_PageUp, QtCore.Qt.Key_PageDown]:
self.parent().textArea.keyPressEvent(event)
QtGui.QLineEdit.keyPressEvent(self, event)
class PesterConvo(QtGui.QFrame): class PesterConvo(QtGui.QFrame):
def __init__(self, chum, initiated, mainwindow, parent=None): def __init__(self, chum, initiated, mainwindow, parent=None):
@ -343,7 +357,7 @@ class PesterConvo(QtGui.QFrame):
self.textArea.append(convertTags(msg)) self.textArea.append(convertTags(msg))
self.mainwindow.chatlog.log(self.title(), convertTags(msg, "bbcode")) self.mainwindow.chatlog.log(self.title(), convertTags(msg, "bbcode"))
self.newmessage = False self.newmessage = False
self.history = [] self.history = PesterHistory()
def title(self): def title(self):
return self.chum.handle return self.chum.handle
@ -411,6 +425,7 @@ class PesterConvo(QtGui.QFrame):
def focusInEvent(self, event): def focusInEvent(self, event):
self.clearNewMessage() self.clearNewMessage()
self.textInput.setFocus() self.textInput.setFocus()
def raiseChat(self): def raiseChat(self):
self.activateWindow() self.activateWindow()
self.raise_() self.raise_()
@ -457,6 +472,7 @@ class PesterConvo(QtGui.QFrame):
text = unicode(self.textInput.text()) text = unicode(self.textInput.text())
if text == "": if text == "":
return return
self.history.add(text)
# deal with quirks here # deal with quirks here
if self.applyquirks: if self.applyquirks:
qtext = self.mainwindow.userprofile.quirks.apply(text) qtext = self.mainwindow.userprofile.quirks.apply(text)

BIN
convo.pyc

Binary file not shown.

View file

@ -176,21 +176,30 @@ class PesterProfile(object):
class PesterHistory(object): class PesterHistory(object):
def __init__(self): def __init__(self):
self.history = [] self.history = []
self.current = -1 self.current = 0
def next(self): self.saved = None
if self.current == -1: def next(self, text):
return "" if self.current == 0:
return None
if self.current == len(self.history):
self.save(text)
self.current -= 1
text = self.history[self.current] text = self.history[self.current]
if self.current > 0:
self.current -= 1
return text return text
def prev(self): def prev(self):
if self.current == -1 or self.current == len(self.history) - 1:
return ""
self.current += 1 self.current += 1
if self.current >= len(self.history):
self.current = len(self.history)
return self.retrieve()
return self.history[self.current] return self.history[self.current]
def reset(self): def reset(self):
self.current = len(self.history) - 1 self.current = len(self.history)
self.saved = None
def save(self, text):
self.saved = text
def retrieve(self):
return self.saved
def add(self, text): def add(self, text):
self.history.append(text) if len(self.history) == 0 or text != self.history[len(self.history)-1]:
self.current = len(self.history) - 1 self.history.append(text)
self.reset()

Binary file not shown.

Binary file not shown.

BIN
irc.pyc

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -543,6 +543,7 @@ class PesterMemo(PesterConvo):
text = unicode(self.textInput.text()) text = unicode(self.textInput.text())
if text == "": if text == "":
return return
self.history.add(text)
if self.time.getTime() == None: if self.time.getTime() == None:
self.sendtime() self.sendtime()
grammar = self.time.getGrammar() grammar = self.time.getGrammar()

BIN
memos.pyc

Binary file not shown.

View file

@ -487,3 +487,10 @@ class LoadingScreen(QtGui.QDialog):
self.layout.addWidget(self.loadinglabel) self.layout.addWidget(self.loadinglabel)
self.layout.addWidget(self.cancel) self.layout.addWidget(self.cancel)
self.setLayout(self.layout) self.setLayout(self.layout)
class AboutPesterchum(QtGui.QMessageBox):
def __init__(self, parent=None):
QtGui.QMessageBox.__init__(self, parent)
self.setText("P3ST3RCHUM V. 0.1.2")
self.setInformativeText("Programming by illuminatedwax (ghostDunk), art by Grimlive (aquaMarinist)")
self.mainwindow = parent

BIN
menus.pyc

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1 +1 @@
{"tabs": true, "soundon": true, "chums": ["marineAquist", "unknownTraveler", "tentacleTherapist", "macruralAlchemist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "adiosToreador", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "maxiumumFatness", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "acapellaWaterfall", "anguillaNuntia", "oilslickOrchid", "confusedTransient"], "defaultprofile": "ghostDunk", "block": []} {"tabs": true, "soundon": true, "chums": ["marineAquist", "unknownTraveler", "tentacleTherapist", "macruralAlchemist", "vaginalEngineer", "mechanicalSpectacle", "carcinoGeneticist", "schlagzeugGator", "gamblingGenocider", "gardenGnostic", "superGhost", "centaursTesticle", "arachnidsGrip", "grimAuxiliatrix", "remoteBloodbath", "nitroZealist", "greenZephyr", "arsenicCatnip", "adiosToreador", "cuttlefishCuller", "rageInducer", "gallowsCalibrator", "caligulasAquarium", "terminallyCapricious", "illuminatedWax", "aquaMarinist", "maxiumumFatness", "elegantDiversion", "moirailBunp", "uroborosUnbound", "androidTechnician", "midnightSparrow", "apocalypseArisen", "acapellaWaterfall", "anguillaNuntia", "oilslickOrchid", "confusedTransient", "pretentiousFantasia"], "defaultprofile": "ghostDunk", "block": []}

View file

@ -14,7 +14,7 @@ import pygame
from menus import PesterChooseQuirks, PesterChooseTheme, \ from menus import PesterChooseQuirks, PesterChooseTheme, \
PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList, \ PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList, \
LoadingScreen LoadingScreen, AboutPesterchum
from dataobjs import PesterProfile, Mood, pesterQuirk, pesterQuirks from dataobjs import PesterProfile, Mood, pesterQuirk, pesterQuirks
from generic import PesterIcon, RightClickList, MultiTextDialog, PesterList from generic import PesterIcon, RightClickList, MultiTextDialog, PesterList
from convo import PesterTabWindow, PesterText, PesterInput, PesterConvo from convo import PesterTabWindow, PesterText, PesterInput, PesterConvo
@ -109,25 +109,26 @@ class PesterProfileDB(dict):
self.save() self.save()
class pesterTheme(dict): class pesterTheme(dict):
def __init__(self, name): def __init__(self, name, default=False):
self.path = "themes/%s" % (name) self.path = "themes/%s" % (name)
self.name = name self.name = name
fp = open(self.path+"/style.js") fp = open(self.path+"/style.js")
theme = json.load(fp, object_hook=self.pathHook) theme = json.load(fp, object_hook=self.pathHook)
self.update(theme) self.update(theme)
fp.close() fp.close()
defaultfp = open("themes/pesterchum/style.js") # set default if not default:
defaultTheme = json.load(defaultfp, object_hook=self.pathHook) self.defaultTheme = pesterTheme("pesterchum", default=True)
self.defaultTheme = defaultTheme
defaultfp.close()
def __getitem__(self, key): def __getitem__(self, key):
keys = key.split("/") keys = key.split("/")
v = dict.__getitem__(self, keys.pop(0)) v = dict.__getitem__(self, keys.pop(0))
for k in keys: for k in keys:
try: try:
v = v[k] v = v[k]
except KeyError: except KeyError, e:
v = self.defaultTheme[k] if hasattr(self, 'defaultTheme'):
return self.defaultTheme[key]
else:
raise e
return v return v
def pathHook(self, d): def pathHook(self, d):
for (k, v) in d.iteritems(): for (k, v) in d.iteritems():
@ -136,19 +137,23 @@ class pesterTheme(dict):
d[k] = s.safe_substitute(path=self.path) d[k] = s.safe_substitute(path=self.path)
return d return d
def get(self, key, default): def get(self, key, default):
try: keys = key.split("/")
ret = self[key] v = dict.__getitem__(self, keys.pop(0))
except KeyError: for k in keys:
return default try:
else: v = v[k]
return ret except KeyError:
return default
return v
def has_key(self, key): def has_key(self, key):
try: keys = key.split("/")
self[key] v = dict.__getitem__(self, keys.pop(0))
except KeyError: for k in keys:
return False try:
else: v = v[k]
return True except KeyError:
return False
return True
class userConfig(object): class userConfig(object):
def __init__(self): def __init__(self):
@ -684,6 +689,14 @@ class PesterWindow(MovingWindow):
profilemenu.addAction(changecoloraction) profilemenu.addAction(changecoloraction)
profilemenu.addAction(switch) profilemenu.addAction(switch)
self.aboutAction = QtGui.QAction(self.theme["main/menus/help/about"], self)
self.connect(self.aboutAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('aboutPesterchum()'))
helpmenu = self.menu.addMenu(self.theme["main/menus/help/_name"])
self.helpmenu = helpmenu
self.helpmenu.addAction(self.aboutAction)
self.closeButton = WMButton(PesterIcon(self.theme["main/close/image"]), self) self.closeButton = WMButton(PesterIcon(self.theme["main/close/image"]), self)
self.connect(self.closeButton, QtCore.SIGNAL('clicked()'), self.connect(self.closeButton, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('closeToTray()')) self, QtCore.SLOT('closeToTray()'))
@ -923,6 +936,8 @@ class PesterWindow(MovingWindow):
self.changecoloraction.setText(theme["main/menus/profile/color"]) self.changecoloraction.setText(theme["main/menus/profile/color"])
self.switch.setText(theme["main/menus/profile/switch"]) self.switch.setText(theme["main/menus/profile/switch"])
self.profilemenu.setTitle(theme["main/menus/profile/_name"]) self.profilemenu.setTitle(theme["main/menus/profile/_name"])
self.aboutAction.setText(self.theme["main/menus/help/about"])
self.helpmenu.setTitle(self.theme["main/menus/help/_name"])
# moods # moods
self.moodsLabel.setText(theme["main/moodlabel/text"]) self.moodsLabel.setText(theme["main/moodlabel/text"])
@ -976,9 +991,7 @@ class PesterWindow(MovingWindow):
self.currentMoodIcon.move(*theme["main/mychumhandle/currentMood"]) self.currentMoodIcon.move(*theme["main/mychumhandle/currentMood"])
self.currentMoodIcon.show() self.currentMoodIcon.show()
else: else:
print "no mood :("
if hasattr(self, 'currentMoodIcon') and self.currentMoodIcon: if hasattr(self, 'currentMoodIcon') and self.currentMoodIcon:
print "hiding..."
self.currentMoodIcon.hide() self.currentMoodIcon.hide()
self.currentMoodIcon = None self.currentMoodIcon = None
@ -1475,6 +1488,13 @@ class PesterWindow(MovingWindow):
if ret == QtGui.QMessageBox.Cancel: if ret == QtGui.QMessageBox.Cancel:
return return
self.changeProfile() self.changeProfile()
@QtCore.pyqtSlot()
def aboutPesterchum(self):
if hasattr(self, 'aboutwindow') and self.aboutwindow:
return
self.aboutwindow = AboutPesterchum(self)
self.aboutwindow.exec_()
self.aboutwindow = None
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString) @QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
def nickCollision(self, handle, tmphandle): def nickCollision(self, handle, tmphandle):

View file

@ -28,6 +28,8 @@
"theme": "THEME", "theme": "THEME",
"block": "TROLLSLUM", "block": "TROLLSLUM",
"quirks": "QUIRKS"}, "quirks": "QUIRKS"},
"help": { "_name": "HELP",
"about": "ABOUT" },
"rclickchumlist": {"pester": "PESTER", "rclickchumlist": {"pester": "PESTER",
"removechum": "REMOVE CHUM", "removechum": "REMOVE CHUM",
"blockchum": "BLOCK", "blockchum": "BLOCK",

BIN
trayicon32.icns Normal file

Binary file not shown.

BIN
trayicon32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB