more buttons

This commit is contained in:
Stephen Dranger 2011-01-29 06:33:35 -06:00
parent dd7c0a7887
commit 9408b615c5
5 changed files with 112 additions and 22 deletions

5
TODO
View file

@ -1,6 +1,4 @@
Features: Features:
* mychumhandle/color/pester button
* User profile options (color...?)
* Quirks * Quirks
-- package -- package
* menubar should pass on mouse move * menubar should pass on mouse move
@ -9,11 +7,14 @@ Features:
* Block list * Block list
* User list/add from list * User list/add from list
* User commands/stop user from sending commands accidentally * User commands/stop user from sending commands accidentally
* cleanup theme code
-- release alpha -- release alpha
* User profile menu options (color...?)
* System tray menu * System tray menu
* comment history (up button) * comment history (up button)
* Chat rooms * Chat rooms
* Implement TC options * Implement TC options
* Transparent background
-- release beta -- release beta
* theme elements define, implement * theme elements define, implement
* Theme checking * Theme checking

View file

@ -120,6 +120,10 @@ class pesterTheme(dict):
d[k] = s.substitute(path=self.path) d[k] = s.substitute(path=self.path)
return d return d
class pesterQuirks(object):
def __init__(self, quirklist):
self.quirklist = quirklist
class userConfig(object): class userConfig(object):
def __init__(self): def __init__(self):
fp = open("pesterchum.js") fp = open("pesterchum.js")
@ -193,11 +197,11 @@ class userProfile(object):
self.save() self.save()
def setColor(self, color): def setColor(self, color):
self.chat.color = color self.chat.color = color
self.userprofile["color"] = color.name() self.userprofile["color"] = unicode(color.name())
self.save() self.save()
def setQuirks(self, quirks): def setQuirks(self, quirks):
self.quirks = quirks self.quirks = quirks
self.userprofile["quirks"] = quirks.repr() self.userprofile["quirks"] = self.quirks.quirklist
self.save() self.save()
def getTheme(self): def getTheme(self):
return self.theme return self.theme
@ -215,10 +219,6 @@ class userProfile(object):
newprofile.save() newprofile.save()
return newprofile return newprofile
class pesterQuirks(object):
def __init__(self, quirklist):
self.quirklist = quirklist
class PesterChooseTheme(QtGui.QDialog): class PesterChooseTheme(QtGui.QDialog):
def __init__(self, config, theme, parent): def __init__(self, config, theme, parent):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
@ -271,7 +271,7 @@ class PesterChooseProfile(QtGui.QDialog):
self.chumHandle = QtGui.QLineEdit(self) self.chumHandle = QtGui.QLineEdit(self)
self.chumHandle.setMinimumWidth(200) self.chumHandle.setMinimumWidth(200)
self.chumHandleLabel = QtGui.QLabel(self.theme["main/labels/mychumhandle"], self) self.chumHandleLabel = QtGui.QLabel(self.theme["main/mychumhandle/label/text"], self)
self.chumColorButton = QtGui.QPushButton(self) self.chumColorButton = QtGui.QPushButton(self)
self.chumColorButton.resize(50, 20) self.chumColorButton.resize(50, 20)
self.chumColorButton.setStyleSheet("background: %s" % (userprofile.chat.colorhtml())) self.chumColorButton.setStyleSheet("background: %s" % (userprofile.chat.colorhtml()))
@ -962,6 +962,32 @@ class PesterWindow(MovingWindow):
self.addChumButton.setStyleSheet(self.theme["main/addchum/style"]) self.addChumButton.setStyleSheet(self.theme["main/addchum/style"])
self.connect(self.addChumButton, QtCore.SIGNAL('clicked()'), self.connect(self.addChumButton, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('addChumWindow()')) self, QtCore.SLOT('addChumWindow()'))
self.pesterButton = QtGui.QPushButton(self.theme["main/pester/text"], self)
self.pesterButton.resize(*self.theme["main/pester/size"])
self.pesterButton.move(*self.theme["main/pester/loc"])
self.pesterButton.setStyleSheet(self.theme["main/pester/style"])
self.connect(self.pesterButton, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('pesterSelectedChum()'))
self.mychumhandleLabel = QtGui.QLabel(self.theme["main/mychumhandle/label/text"], self)
self.mychumhandleLabel.move(*self.theme["main/mychumhandle/label/loc"])
self.mychumhandleLabel.setStyleSheet(self.theme["main/mychumhandle/label/style"])
self.mychumhandle = QtGui.QPushButton(self.profile().handle, self)
self.mychumhandle.setFlat(True)
self.mychumhandle.move(*self.theme["main/mychumhandle/handle/loc"])
self.mychumhandle.resize(*self.theme["main/mychumhandle/handle/size"])
self.mychumhandle.setStyleSheet(self.theme["main/mychumhandle/handle/style"])
self.connect(self.mychumhandle, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('switchProfile()'))
self.mychumcolor = QtGui.QPushButton(self)
self.mychumcolor.resize(*self.theme["main/mychumhandle/colorswatch/size"])
self.mychumcolor.move(*self.theme["main/mychumhandle/colorswatch/loc"])
self.mychumcolor.setStyleSheet("background: %s" % (self.profile().colorhtml()))
if self.theme["main/mychumhandle/colorswatch/text"]:
self.mychumcolor.setText(self.theme["main/mychumhandle/colorswatch/text"])
self.connect(self.mychumcolor, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('changeMyColor()'))
if not pygame.mixer: if not pygame.mixer:
self.alarm = NoneSound() self.alarm = NoneSound()
@ -969,12 +995,14 @@ class PesterWindow(MovingWindow):
self.alarm = pygame.mixer.Sound(self.theme["main/sounds/alertsound"]) self.alarm = pygame.mixer.Sound(self.theme["main/sounds/alertsound"])
self.waitingMessages = waitingMessageHolder(self) self.waitingMessages = waitingMessageHolder(self)
# these are mostly initial values so we dont get AttributeErrors later
self.convos = {} self.convos = {}
self.tabconvo = None self.tabconvo = None
self.optionmenu = None self.optionmenu = None
self.choosetheme = None self.choosetheme = None
self.chooseprofile = None self.chooseprofile = None
self.addchumdialog = None self.addchumdialog = None
self.colorDialog = None
def profile(self): def profile(self):
return self.userprofile.chat return self.userprofile.chat
@ -1070,14 +1098,33 @@ class PesterWindow(MovingWindow):
self.moods = PesterMoodHandler(self, *[PesterMoodButton(self, **d) for d in self.theme["main/moods"]]) self.moods = PesterMoodHandler(self, *[PesterMoodButton(self, **d) for d in self.theme["main/moods"]])
self.moods.showButtons() self.moods.showButtons()
# chum # chum
self.addChumButton.setText(self.theme["main/addchum/text"])
self.addChumButton.resize(*self.theme["main/addchum/size"]) self.addChumButton.resize(*self.theme["main/addchum/size"])
self.addChumButton.move(*self.theme["main/addchum/loc"]) self.addChumButton.move(*self.theme["main/addchum/loc"])
self.addChumButton.setStyleSheet(self.theme["main/addchum/style"]) self.addChumButton.setStyleSheet(self.theme["main/addchum/style"])
self.pesterButton.setText(self.theme["main/pester/text"])
self.pesterButton.resize(*self.theme["main/pester/size"])
self.pesterButton.move(*self.theme["main/pester/loc"])
self.pesterButton.setStyleSheet(self.theme["main/pester/style"])
# do open windows # do open windows
if self.tabconvo: if self.tabconvo:
self.tabconvo.changeTheme(theme) self.tabconvo.changeTheme(theme)
for c in self.convos.values(): for c in self.convos.values():
c.changeTheme(theme) c.changeTheme(theme)
# buttons
self.mychumhandleLabel.setText(self.theme["main/mychumhandle/label/text"])
self.mychumhandleLabel.move(*self.theme["main/mychumhandle/label/loc"])
self.mychumhandleLabel.setStyleSheet(self.theme["main/mychumhandle/label/style"])
self.mychumhandle.setText(self.profile().handle)
self.mychumhandle.move(*self.theme["main/mychumhandle/handle/loc"])
self.mychumhandle.resize(*self.theme["main/mychumhandle/handle/size"])
self.mychumhandle.setStyleSheet(self.theme["main/mychumhandle/handle/style"])
self.mychumcolor.resize(*self.theme["main/mychumhandle/colorswatch/size"])
self.mychumcolor.move(*self.theme["main/mychumhandle/colorswatch/loc"])
self.mychumcolor.setStyleSheet("background: %s" % (self.profile().colorhtml()))
if self.theme["main/mychumhandle/colorswatch/text"]:
self.mychumcolor.setText(self.theme["main/mychumhandle/colorswatch/text"])
# sounds # sounds
if not pygame.mixer: if not pygame.mixer:
self.alarm = NoneSound() self.alarm = NoneSound()
@ -1105,6 +1152,11 @@ class PesterWindow(MovingWindow):
else: else:
self.waitingMessages.answerMessage() self.waitingMessages.answerMessage()
@QtCore.pyqtSlot()
def pesterSelectedChum(self):
curChum = self.chumList.currentItem()
if curChum:
self.newConversationWindow(curChum)
@QtCore.pyqtSlot(QtGui.QListWidgetItem) @QtCore.pyqtSlot(QtGui.QListWidgetItem)
def newConversationWindow(self, chumlisting): def newConversationWindow(self, chumlisting):
chum = chumlisting.chum chum = chumlisting.chum
@ -1238,14 +1290,23 @@ class PesterWindow(MovingWindow):
self.chooseprofile = None self.chooseprofile = None
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def changeMyColor(self):
if self.colorDialog:
return
self.colorDialog = QtGui.QColorDialog(self)
color = self.colorDialog.getColor(initial=self.profile().color)
self.mychumcolor.setStyleSheet("background: %s" % color.name())
self.userprofile.setColor(color)
self.colorDialog = None
@QtCore.pyqtSlot()
def closeProfile(self): def closeProfile(self):
self.chooseprofile = None self.chooseprofile = None
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def switchProfile(self): def switchProfile(self):
if self.convos: if self.convos:
closeWarning = QtGui.QMessageBox() closeWarning = QtGui.QMessageBox()
closeWarning.setText("WARNING: THIS WILL CLOSE ALL CONVERSATION WINDOWS!") closeWarning.setText("WARNING: CHANGING PROFILES WILL CLOSE ALL CONVERSATION WINDOWS!")
closeWarning.setInformativeText("i warned you bro! i warned you about those windows") closeWarning.setInformativeText("i warned you about windows bro!!!! i told you dog!")
closeWarning.setStandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok) closeWarning.setStandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)
closeWarning.setDefaultButton(QtGui.QMessageBox.Ok) closeWarning.setDefaultButton(QtGui.QMessageBox.Ok)
ret = closeWarning.exec_() ret = closeWarning.exec_()
@ -1381,7 +1442,7 @@ class PesterHandler(DefaultCommandHandler):
handle = nick[0:nick.find("!")] handle = nick[0:nick.find("!")]
self.parent.moodUpdated.emit(handle, Mood("offline")) self.parent.moodUpdated.emit(handle, Mood("offline"))
def part(self, nick, channel): def part(self, nick, channel):
handle = nick[0:oldnick.find("!")] handle = nick[0:nick.find("!")]
if channel == "#pesterchum": if channel == "#pesterchum":
self.parent.moodUpdated.emit(handle, Mood("offline")) self.parent.moodUpdated.emit(handle, Mood("offline"))
def nick(self, oldnick, newnick): def nick(self, oldnick, newnick):

View file

@ -1 +1 @@
{"color": "#00aaff", "theme": "trollian", "quirks": [], "handle": "superGhost"} {"color": "#65cf91", "theme": "trollian", "quirks": [], "handle": "superGhost"}

View file

@ -14,7 +14,7 @@
"sounds": { "alertsound": "$path/alarm.wav" }, "sounds": { "alertsound": "$path/alarm.wav" },
"chums": { "style": "background-color: black;color: white;font: bold;font-family: 'Courier New';selection-background-color:#919191; ", "chums": { "style": "background-color: black;color: white;font: bold;font-family: 'Courier New';selection-background-color:#919191; ",
"loc": [20, 65], "loc": [20, 65],
"size": [266, 300], "size": [266, 270],
"moods": { "chummy": { "icon": "$path/chummy.gif", "moods": { "chummy": { "icon": "$path/chummy.gif",
"color": "white" }, "color": "white" },
"offline": { "icon": "$path/offline.gif", "offline": { "icon": "$path/offline.gif",
@ -43,14 +43,28 @@
"color": "white" } "color": "white" }
} }
}, },
"mychumhandle": { "label": { "text": "MYCHUMHANDLE",
"loc": [70,410],
"style": "color:black;font:bold;" },
"handle": { "style": "border:3px solid yellow; background: black; color:white;",
"loc": [20,430],
"size": [220,30] },
"colorswatch": { "loc": [243,430],
"size": [40,30],
"text": "" }
},
"defaultwindow": { "style": "background: #fdb302; font-family:'Courier New';font:bold;selection-background-color:#919191; " "defaultwindow": { "style": "background: #fdb302; font-family:'Courier New';font:bold;selection-background-color:#919191; "
}, },
"labels": { "mychumhandle": "MYCHUMHANDLE" },
"addchum": { "style": "background: #fdb302; border:5px solid yellow; font: bold;", "addchum": { "style": "background: #fdb302; border:5px solid yellow; font: bold;",
"loc": [20,370], "loc": [20,340],
"size": [100, 50], "size": [100, 40],
"text": "ADD CHUM" "text": "ADD CHUM"
}, },
"pester": { "style": "background: #fdb302; border:5px solid yellow; font: bold;",
"loc": [130,340],
"size": [100, 40],
"text": "PESTER!"
},
"defaultmood": 0, "defaultmood": 0,
"moods": [ "moods": [
{ "style": "text-align:left; background: white; border:3px solid black; padding: 5px;color:#919191;", { "style": "text-align:left; background: white; border:3px solid black; padding: 5px;color:#919191;",

View file

@ -1,5 +1,5 @@
{"main": {"main":
{"style": "background-image:url($path/tnbg2.png);", {"style": "background-image:url($path/tnbg2.png);background-color:rgba(255,255,255,0);",
"size": [300, 620], "size": [300, 620],
"icon": "$path/trayicon3.png", "icon": "$path/trayicon3.png",
"newmsgicon": "$path/trayicon.gif", "newmsgicon": "$path/trayicon.gif",
@ -14,7 +14,7 @@
"sounds": { "alertsound": "$path/alarm.wav" }, "sounds": { "alertsound": "$path/alarm.wav" },
"chums": { "style": "background-color: black;color: white;font: bold;font-family: 'Courier New';selection-background-color:#ffb6b6; ", "chums": { "style": "background-color: black;color: white;font: bold;font-family: 'Courier New';selection-background-color:#ffb6b6; ",
"loc": [20, 65], "loc": [20, 65],
"size": [266, 300], "size": [266, 270],
"moods": { "chummy": { "icon": "$path/chummy.gif", "moods": { "chummy": { "icon": "$path/chummy.gif",
"color": "white" }, "color": "white" },
"offline": { "icon": "$path/offline.gif", "offline": { "icon": "$path/offline.gif",
@ -43,14 +43,28 @@
"color": "white" } "color": "white" }
} }
}, },
"mychumhandle": { "label": { "text": "MYTROLLTAG",
"loc": [85,410],
"style": "color:black;font:bold;" },
"handle": { "style": "border:3px solid #550000; background: black; color:white;",
"loc": [20,430],
"size": [220,30] },
"colorswatch": { "loc": [243,430],
"size": [40,30],
"text": "" }
},
"defaultwindow": { "style": "background: #e5000f; font-family:'Courier New';font:bold;selection-background-color:#ffb6b6; " "defaultwindow": { "style": "background: #e5000f; font-family:'Courier New';font:bold;selection-background-color:#ffb6b6; "
}, },
"labels": { "mychumhandle": "MYTROLLTAG" },
"addchum": { "style": "background: black; border:5px solid #550000; font: bold;color:white;", "addchum": { "style": "background: black; border:5px solid #550000; font: bold;color:white;",
"loc": [20,370], "loc": [20,340],
"size": [100, 50], "size": [100, 40],
"text": "ADD LOSER" "text": "ADD LOSER"
}, },
"pester": { "style": "background: black; border:5px solid #550000; font: bold;color:white;",
"loc": [130,340],
"size": [100, 40],
"text": "TROLL"
},
"defaultmood": 7, "defaultmood": 7,
"moods": [ "moods": [
{ "style": "text-align:left; background: black; border:3px solid black; padding: 5px;color:#dbdbdb;", { "style": "text-align:left; background: black; border:3px solid black; padding: 5px;color:#dbdbdb;",