From dc2eaf7ce85355bbde0985332a8e89a9e4029297 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Mon, 12 Sep 2011 21:03:05 -0700 Subject: [PATCH] Low-bandwidth mode --- CHANGELOG.mkdn | 1 + TODO.mkdn | 1 + irc.py | 8 +++++--- menus.py | 11 +++++++++++ pesterchum.py | 9 +++++++++ profile.py | 2 ++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 8004d30..68b5fe9 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -32,6 +32,7 @@ CHANGELOG * Toast Notifications - Kiooeht [evacipatedBox] * Disable randomEncounter options when it's offline - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance]) * Sort list of memos alphabetically or by number of users - Kiooeht [evacipatedBox] (Idea: [lostGash]) +* Low-bandwidth mode - Kiooeht [evacipatedBox] (Idea: [canLover]) * Bug fixes * Don't delete random chum when blocking someone not on chumroll - Kiooeht [evacipatedBox] * Openning global userlist doesn't reset OP status of memo users - Kiooeht [evacipatedBox] diff --git a/TODO.mkdn b/TODO.mkdn index afb3897..cfa38b0 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -33,6 +33,7 @@ Bugs * Closing a timeclone doesn't actually cease for everyone else * Kill Zalgo * Random invisible, tiny links to last link at end of every message +* Profiles using themes you don't have break everything Windows Bugs ------------ diff --git a/irc.py b/irc.py index cb9a38f..273af2c 100644 --- a/irc.py +++ b/irc.py @@ -229,6 +229,7 @@ class PesterIRC(QtCore.QThread): c = unicode(channel) try: helpers.part(self.cli, c) + self.cli.command_handler.joined = False except socket.error: self.setConnectionBroken() @QtCore.pyqtSlot(QtCore.QString, QtCore.QString) @@ -390,10 +391,11 @@ class PesterHandler(DefaultCommandHandler): def welcome(self, server, nick, msg): self.parent.setConnected() - helpers.join(self.client, "#pesterchum") mychumhandle = self.mainwindow.profile().handle mymood = self.mainwindow.profile().mood.value() - helpers.msg(self.client, "#pesterchum", "MOOD >%d" % (mymood)) + if not self.mainwindow.config.lowBandwidth(): + helpers.join(self.client, "#pesterchum") + helpers.msg(self.client, "#pesterchum", "MOOD >%d" % (mymood)) def nicknameinuse(self, server, cmd, nick, msg): newnick = "pesterClient%d" % (random.randint(100,999)) @@ -484,7 +486,7 @@ class PesterHandler(DefaultCommandHandler): pl = PesterList(namelist) del self.channelnames[channel] self.parent.namesReceived.emit(channel, pl) - if channel == "#pesterchum" and not hasattr(self, "joined"): + if channel == "#pesterchum" and (not hasattr(self, "joined") or not self.joined): self.joined = True self.parent.mainwindow.randhandler.setRunning(self.parent.mainwindow.randhandler.randNick in namelist) chums = self.mainwindow.chumList.chums diff --git a/menus.py b/menus.py index 30325c6..111c99f 100644 --- a/menus.py +++ b/menus.py @@ -1006,6 +1006,15 @@ class PesterOptions(QtGui.QDialog): self.tabs.button(-2).setChecked(True) self.pages = QtGui.QStackedWidget(self) + self.bandwidthcheck = QtGui.QCheckBox("Low Bandwidth", self) + if self.config.lowBandwidth(): + self.bandwidthcheck.setChecked(True) + bandwidthLabel = QtGui.QLabel("(Stops you for receiving the flood of MOODS,\n" + " though stops chumlist from working properly)") + font = bandwidthLabel.font() + font.setPointSize(8) + bandwidthLabel.setFont(font) + self.tabcheck = QtGui.QCheckBox("Tabbed Conversations", self) if self.config.tabs(): self.tabcheck.setChecked(True) @@ -1234,6 +1243,8 @@ class PesterOptions(QtGui.QDialog): layout_chumlist.addWidget(self.showemptycheck) layout_chumlist.addWidget(self.showonlinenumbers) layout_chumlist.addLayout(layout_3) + layout_chumlist.addWidget(self.bandwidthcheck) + layout_chumlist.addWidget(bandwidthLabel) self.pages.addWidget(widget) # Conversations diff --git a/pesterchum.py b/pesterchum.py index 3cec418..0f75a94 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -2362,6 +2362,15 @@ class PesterWindow(MovingWindow): curnotify = self.config.notifyOptions() if notifysetting != curnotify: self.config.set('notifyOptions', notifysetting) + # low bandwidth + bandwidthsetting = self.optionmenu.bandwidthcheck.isChecked() + curbandwidth = self.config.lowBandwidth() + if bandwidthsetting != curbandwidth: + self.config.set('lowBandwidth', bandwidthsetting) + if bandwidthsetting: + self.leftChannel.emit("#pesterchum") + else: + self.joinChannel.emit("#pesterchum") # advanced ## user mode if self.advanced: diff --git a/profile.py b/profile.py index 4fc65e5..e40b5e5 100644 --- a/profile.py +++ b/profile.py @@ -197,6 +197,8 @@ class userConfig(object): return self.config.get('notifyType', "default") def notifyOptions(self): return self.config.get('notifyOptions', self.SIGNIN | self.NEWMSG | self.NEWCONVO | self.INITIALS) + def lowBandwidth(self): + return self.config.get('lowBandwidth', True) def addChum(self, chum): if chum.handle not in self.chums(): fp = open(self.filename) # what if we have two clients open??