tabs complete!

This commit is contained in:
Stephen Dranger 2011-01-27 16:16:14 -06:00
parent 0e80643233
commit 1d93008e2a
7 changed files with 18 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -268,6 +268,7 @@ class PesterTabWindow(QtGui.QFrame):
self.currentConvo = convo self.currentConvo = convo
self.layout.addWidget(convo) self.layout.addWidget(convo)
self.setWindowIcon(convo.chum.mood.icon(self.theme)) self.setWindowIcon(convo.chum.mood.icon(self.theme))
self.setWindowTitle(convo.chum.handle)
self.activateWindow() self.activateWindow()
self.raise_() self.raise_()
convo.raiseChat() convo.raiseChat()
@ -408,10 +409,11 @@ class PesterWindow(MovingWindow):
self.tabconvo = None self.tabconvo = None
self.optionmenu = None self.optionmenu = None
def closeEvent(self, event): def closeEvent(self, event):
for c in self.convos.values():
c.close()
if self.tabconvo: if self.tabconvo:
self.tabconvo.close() self.tabconvo.close()
else:
for c in self.convos.values():
c.close()
event.accept() event.accept()
def newMessage(self, handle, msg): def newMessage(self, handle, msg):
if not self.convos.has_key(handle): if not self.convos.has_key(handle):
@ -438,9 +440,7 @@ class PesterWindow(MovingWindow):
return return
if self.config.tabs(): if self.config.tabs():
if not self.tabconvo: if not self.tabconvo:
self.tabconvo = PesterTabWindow(self) self.createTabWindow()
self.connect(self.tabconvo, QtCore.SIGNAL('windowClosed()'),
self, QtCore.SLOT('tabsClosed()'))
convoWindow = PesterConvo(chum, initiated, self, self.tabconvo) convoWindow = PesterConvo(chum, initiated, self, self.tabconvo)
self.tabconvo.show() self.tabconvo.show()
else: else:
@ -452,6 +452,10 @@ class PesterWindow(MovingWindow):
self.convos[chum.handle] = convoWindow self.convos[chum.handle] = convoWindow
self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated) self.newConvoStarted.emit(QtCore.QString(chum.handle), initiated)
convoWindow.show() convoWindow.show()
def createTabWindow(self):
self.tabconvo = PesterTabWindow(self)
self.connect(self.tabconvo, QtCore.SIGNAL('windowClosed()'),
self, QtCore.SLOT('tabsClosed()'))
@QtCore.pyqtSlot(QtGui.QListWidgetItem) @QtCore.pyqtSlot(QtGui.QListWidgetItem)
def newConversationWindow(self, chumlisting): def newConversationWindow(self, chumlisting):
@ -512,11 +516,19 @@ class PesterWindow(MovingWindow):
self.tabconvo.closeSoft() self.tabconvo.closeSoft()
# save options # save options
self.config.set("tabs", tabsetting) self.config.set("tabs", tabsetting)
pass
elif tabsetting and not curtab: elif tabsetting and not curtab:
# combine # combine
self.createTabWindow()
newconvos = {}
for (h,c) in self.convos.iteritems():
c.setParent(self.tabconvo)
self.tabconvo.addChat(c)
self.tabconvo.show()
newconvos[h] = c
self.convos = newconvos
# save options # save options
self.config.set("tabs", tabsetting) self.config.set("tabs", tabsetting)
pass pass
self.optionmenu = None self.optionmenu = None