Customizable idle time

This commit is contained in:
Kiooeht 2011-04-28 00:51:02 -07:00
parent 88d0adb1d1
commit 90556079db
3 changed files with 26 additions and 2 deletions

View file

@ -11,6 +11,7 @@ CHANGELOG
* Individually turn quirks on and off - Kiooeht [evacipatedBox]
* More canon trollian theme timeline indicators - [binaryCabalist]
* By mood chum sorting - Kiooeht [evacipatedBox]
* Customizable idle time - Kiooeht [evacipatedBox]
* Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox]

View file

@ -572,7 +572,7 @@ class PesterOptions(QtGui.QDialog):
self.tabs = QtGui.QButtonGroup(self)
self.connect(self.tabs, QtCore.SIGNAL('buttonClicked(int)'),
self, QtCore.SLOT('changePage(int)'))
tabNames = ["Interface", "Chum List", "Conversations", "Logging"]
tabNames = ["Interface", "Chum List", "Conversations", "Logging", "Idle"]
for t in tabNames:
button = QtGui.QPushButton(t)
self.tabs.addButton(button)
@ -634,6 +634,14 @@ class PesterOptions(QtGui.QDialog):
self.logmemoscheck = QtGui.QCheckBox("Log all memos", self)
self.logmemoscheck.setChecked(self.config.logMemos())
times = ["1", "5", "10", "15", "30"]
self.idleBox = QtGui.QComboBox(self)
self.idleBox.addItems(times)
self.idleBox.setCurrentIndex(self.idleBox.findText(str(self.config.idleTime())))
layout_5 = QtGui.QHBoxLayout()
layout_5.addWidget(QtGui.QLabel("Minutes before Idle:"))
layout_5.addWidget(self.idleBox)
self.ok = QtGui.QPushButton("OK", self)
self.ok.setDefault(True)
self.connect(self.ok, QtCore.SIGNAL('clicked()'),
@ -687,6 +695,13 @@ class PesterOptions(QtGui.QDialog):
layout_logs.addWidget(self.logmemoscheck)
self.pages.addWidget(widget)
# Idle
widget = QtGui.QWidget()
layout_idle = QtGui.QVBoxLayout(widget)
layout_idle.setAlignment(QtCore.Qt.AlignTop)
layout_idle.addLayout(layout_5)
self.pages.addWidget(widget)
layout_0 = QtGui.QVBoxLayout()
layout_1 = QtGui.QHBoxLayout()
layout_1.addLayout(layout_4)

View file

@ -340,6 +340,8 @@ class userConfig(object):
return self.config.get('logMemos', True)
def disableUserLinks(self):
return not self.config.get('userLinks', True)
def idleTime(self):
return self.config.get('idleTime', 10)
def addChum(self, chum):
if chum.handle not in self.chums():
fp = open(self.filename) # what if we have two clients open??
@ -1449,7 +1451,7 @@ class PesterWindow(MovingWindow):
self.waitingMessages = waitingMessageHolder(self)
self.autoidle = False
self.idlethreshold = 600
self.idlethreshold = 60*self.config.idleTime()
self.idletimer = QtCore.QTimer(self)
self.idleposition = QtGui.QCursor.pos()
self.idletime = 0
@ -2306,6 +2308,12 @@ class PesterWindow(MovingWindow):
curlinks = self.config.disableUserLinks()
if linkssetting != curlinks:
self.config.set('userLinks', not linkssetting)
# idle time
idlesetting = int(unicode(self.optionmenu.idleBox.currentText()))
curidle = self.config.idleTime()
if idlesetting != curidle:
self.config.set('idleTime', idlesetting)
self.idlethreshold = 60*idlesetting
self.optionmenu = None
@QtCore.pyqtSlot()