diff --git a/irc.py b/irc.py index 94b492c..8569e76 100644 --- a/irc.py +++ b/irc.py @@ -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: diff --git a/menus.py b/menus.py index 4ecf1b2..833d736 100644 --- a/menus.py +++ b/menus.py @@ -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) diff --git a/pesterchum b/pesterchum index a28ee59..f351cb8 100755 --- a/pesterchum +++ b/pesterchum @@ -1,3 +1,3 @@ #!/bin/sh -python2.6 pesterchum.py \ No newline at end of file +python2.6 pesterchum.py $@ diff --git a/pesterchum.py b/pesterchum.py index cbe5a13..f81b3f3 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -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