Advanced mode: See and change current IRC user mode

This commit is contained in:
Kiooeht 2011-05-11 23:46:53 -07:00
parent b4cb15ec05
commit 183b9f46c5
4 changed files with 42 additions and 3 deletions

3
irc.py
View file

@ -383,6 +383,9 @@ class PesterHandler(DefaultCommandHandler):
self.parent.channelListReceived.emit(pl)
self.channel_list = []
def umodeis(self, server, handle, modes):
self.parent.mainwindow.modes = modes
def getMood(self, *chums):
chumglub = "GETMOOD "
for c in chums:

View file

@ -622,6 +622,7 @@ class PesterOptions(QtGui.QDialog):
self.connect(self.tabs, QtCore.SIGNAL('buttonClicked(int)'),
self, QtCore.SLOT('changePage(int)'))
tabNames = ["Chum List", "Conversations", "Interface", "Sound", "Logging", "Idle", "Theme"]
if parent.advanced: tabNames.append("Advanced")
for t in tabNames:
button = QtGui.QPushButton(t)
self.tabs.addButton(button)
@ -728,6 +729,11 @@ class PesterOptions(QtGui.QDialog):
layout_close.addWidget(QtGui.QLabel("Close"))
layout_close.addWidget(self.closeBox)
self.modechange = QtGui.QLineEdit(self)
layout_change = QtGui.QHBoxLayout()
layout_change.addWidget(QtGui.QLabel("Change:"))
layout_change.addWidget(self.modechange)
self.ok = QtGui.QPushButton("OK", self)
self.ok.setDefault(True)
self.connect(self.ok, QtCore.SIGNAL('clicked()'),
@ -809,6 +815,15 @@ class PesterOptions(QtGui.QDialog):
layout_theme.addWidget(self.themeBox)
self.pages.addWidget(widget)
# Advanced
if parent.advanced:
widget = QtGui.QWidget()
layout_advanced = QtGui.QVBoxLayout(widget)
layout_advanced.setAlignment(QtCore.Qt.AlignTop)
layout_advanced.addWidget(QtGui.QLabel("Current User Mode: %s" % parent.modes))
layout_advanced.addLayout(layout_change)
self.pages.addWidget(widget)
layout_0 = QtGui.QVBoxLayout()
layout_1 = QtGui.QHBoxLayout()
layout_1.addLayout(layout_4)

View file

@ -1,3 +1,3 @@
#!/bin/sh
python2.6 pesterchum.py
python2.6 pesterchum.py $@

View file

@ -13,6 +13,7 @@ import platform
from PyQt4 import QtGui, QtCore
import pygame
from time import strftime
import getopt
from menus import PesterChooseQuirks, PesterChooseTheme, \
PesterChooseProfile, PesterOptions, PesterUserlist, PesterMemoList, \
@ -1316,7 +1317,7 @@ class MovingWindow(QtGui.QFrame):
class PesterWindow(MovingWindow):
def __init__(self, parent=None):
def __init__(self, parent=None, advanced=False):
MovingWindow.__init__(self, parent,
(QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.FramelessWindowHint))
@ -1324,6 +1325,7 @@ class PesterWindow(MovingWindow):
self.memos = CaseInsensitiveDict()
self.tabconvo = None
self.tabmemo = None
self.advanced = advanced
self.setAutoFillBackground(True)
self.setObjectName("main")
@ -1334,6 +1336,7 @@ class PesterWindow(MovingWindow):
else:
self.userprofile = userProfile(PesterProfile("pesterClient%d" % (random.randint(100,999)), QtGui.QColor("black"), Mood(0)))
self.theme = self.userprofile.getTheme()
self.modes = ""
try:
themeChecker(self.theme)
@ -2429,6 +2432,11 @@ class PesterWindow(MovingWindow):
curopvmess = self.config.opvoiceMessages()
if opvmesssetting != curopvmess:
self.config.set('opvMessages', opvmesssetting)
# advanced
## user mode
newmodes = self.optionmenu.modechange.text()
if newmodes:
self.setChannelMode.emit(self.profile().handle, newmodes, "")
self.optionmenu = None
def setButtonAction(self, button, setting, old):
@ -2638,6 +2646,9 @@ class MainProgram(QtCore.QObject):
QtCore.QObject.__init__(self)
self.app = QtGui.QApplication(sys.argv)
self.app.setApplicationName("Pesterchum 3.14")
self.oppts(sys.argv[1:])
if pygame.mixer:
# we could set the frequency higher but i love how cheesy it sounds
try:
@ -2646,7 +2657,7 @@ class MainProgram(QtCore.QObject):
print "Warning: No sound! %s" % (e)
else:
print "Warning: No sound!"
self.widget = PesterWindow()
self.widget = PesterWindow(advanced=self.advanced)
self.widget.show()
self.trayicon = PesterTray(PesterIcon(self.widget.theme["main/icon"]), self.widget, self.app)
@ -2845,6 +2856,16 @@ class MainProgram(QtCore.QObject):
self.reconnectok = True
self.showLoading(self.widget, "F41L3D: %s" % stop)
def oppts(self, argv):
self.advanced = False
try:
opts, args = getopt.getopt(argv, "", ["advanced"])
except getopt.GetoptError:
return
for opt, arg in opts:
if opt in ("--advanced"):
self.advanced = True
def run(self):
self.irc.start()
self.reconnectok = False