tabs->windows
This commit is contained in:
parent
0f02cb5ae7
commit
0e80643233
1 changed files with 15 additions and 3 deletions
|
@ -203,6 +203,7 @@ class PesterTabWindow(QtGui.QFrame):
|
||||||
self.tabIndices = {}
|
self.tabIndices = {}
|
||||||
self.currentConvo = None
|
self.currentConvo = None
|
||||||
self.changedTab = False
|
self.changedTab = False
|
||||||
|
self.softclose = False
|
||||||
def addChat(self, convo):
|
def addChat(self, convo):
|
||||||
self.convos[convo.chum.handle] = convo
|
self.convos[convo.chum.handle] = convo
|
||||||
# either addTab or setCurrentIndex will trigger changed()
|
# either addTab or setCurrentIndex will trigger changed()
|
||||||
|
@ -220,12 +221,16 @@ class PesterTabWindow(QtGui.QFrame):
|
||||||
nexti = (self.tabIndices[self.currentConvo.chum.handle] + 1) % self.tabs.count()
|
nexti = (self.tabIndices[self.currentConvo.chum.handle] + 1) % self.tabs.count()
|
||||||
self.tabs.setCurrentIndex(nexti)
|
self.tabs.setCurrentIndex(nexti)
|
||||||
|
|
||||||
|
def closeSoft(self):
|
||||||
|
self.softclose = True
|
||||||
|
self.close()
|
||||||
def updateMood(self, handle, mood):
|
def updateMood(self, handle, mood):
|
||||||
i = self.tabIndices[handle]
|
i = self.tabIndices[handle]
|
||||||
self.tabs.setTabIcon(i, mood.icon(self.theme))
|
self.tabs.setTabIcon(i, mood.icon(self.theme))
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
while self.tabs.count() > 0:
|
if not self.softclose:
|
||||||
self.tabClose(0)
|
while self.tabs.count() > 0:
|
||||||
|
self.tabClose(0)
|
||||||
self.windowClosed.emit()
|
self.windowClosed.emit()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
|
@ -457,7 +462,7 @@ class PesterWindow(MovingWindow):
|
||||||
h = str(handle)
|
h = str(handle)
|
||||||
del self.convos[h]
|
del self.convos[h]
|
||||||
self.convoClosed.emit(handle)
|
self.convoClosed.emit(handle)
|
||||||
@QtCore.pyqtSlot(QtCore.QString)
|
@QtCore.pyqtSlot()
|
||||||
def tabsClosed(self):
|
def tabsClosed(self):
|
||||||
del self.tabconvo
|
del self.tabconvo
|
||||||
self.tabconvo = None
|
self.tabconvo = None
|
||||||
|
@ -498,6 +503,13 @@ class PesterWindow(MovingWindow):
|
||||||
tabsetting = self.optionmenu.tabcheck.isChecked()
|
tabsetting = self.optionmenu.tabcheck.isChecked()
|
||||||
if curtab and not tabsetting:
|
if curtab and not tabsetting:
|
||||||
# split tabs into windows
|
# split tabs into windows
|
||||||
|
if self.tabconvo:
|
||||||
|
windows = list(self.tabconvo.convos.values())
|
||||||
|
for w in windows:
|
||||||
|
w.setParent(None)
|
||||||
|
w.show()
|
||||||
|
w.raiseChat()
|
||||||
|
self.tabconvo.closeSoft()
|
||||||
# save options
|
# save options
|
||||||
self.config.set("tabs", tabsetting)
|
self.config.set("tabs", tabsetting)
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue