Merge branch 'MultipleMemoSelection' of https://github.com/brachyonic/pesterchum into brachyonic-MultipleMemoSelection

This commit is contained in:
Kiooeht 2013-02-25 22:13:12 -08:00
commit cab2412284
3 changed files with 25 additions and 16 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
*.swp
*~
logs/*
build/*
profiles/*

View file

@ -1588,6 +1588,7 @@ class PesterMemoList(QtGui.QDialog):
self.label = QtGui.QLabel("MEMOS")
self.channelarea = RightClickTree(self)
self.channelarea.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.channelarea.setStyleSheet(self.theme["main/chums/style"])
self.channelarea.optionsMenu = QtGui.QMenu(self)
self.channelarea.setColumnCount(2)
@ -1599,7 +1600,7 @@ class PesterMemoList(QtGui.QDialog):
self.channelarea.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.connect(self.channelarea,
QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem *, int)'),
self, QtCore.SLOT('joinActivatedMemo()'))
self, QtCore.SLOT('AcceptSelection()'))
self.orjoinlabel = QtGui.QLabel("OR MAKE A NEW MEMO:")
self.newmemo = QtGui.QLineEdit(channel, self)
@ -1616,7 +1617,7 @@ class PesterMemoList(QtGui.QDialog):
self.join = QtGui.QPushButton("JOIN", self)
self.join.setDefault(True)
self.connect(self.join, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('checkEmpty()'))
self, QtCore.SLOT('AcceptIfSelectionMade()'))
layout_ok = QtGui.QHBoxLayout()
layout_ok.addWidget(self.cancel)
layout_ok.addWidget(self.join)
@ -1644,8 +1645,12 @@ class PesterMemoList(QtGui.QDialog):
def newmemoname(self):
return self.newmemo.text()
def selectedmemo(self):
return self.channelarea.currentItem()
def SelectedMemos(self):
return self.channelarea.selectedItems()
def HasSelection(self):
return len(self.SelectedMemos()) > 0 or self.newmemoname()
def updateChannels(self, channels):
for c in channels:
@ -1663,13 +1668,12 @@ class PesterMemoList(QtGui.QDialog):
item.setIcon(QtGui.QIcon(theme["memos/memoicon"]))
@QtCore.pyqtSlot()
def checkEmpty(self):
newmemo = self.newmemoname()
selectedmemo = self.selectedmemo()
if newmemo or selectedmemo:
self.accept()
def AcceptIfSelectionMade(self):
if self.HasSelection():
self.AcceptSelection()
@QtCore.pyqtSlot()
def joinActivatedMemo(self):
def AcceptSelection(self):
self.accept()

View file

@ -40,7 +40,7 @@ else:
minor = int(vnum[vnum.find(".")+1:])
if not ((major > 4) or (major == 4 and minor >= 6)):
print "ERROR: Pesterchum requires Qt version >= 4.6"
print "You currently have version " + vnum + ". Please ungrade Qt"
print "You currently have version " + vnum + ". Please upgrade Qt"
exit()
import ostools
@ -2058,18 +2058,21 @@ class PesterWindow(MovingWindow):
self.memochooser.show()
@QtCore.pyqtSlot()
def joinSelectedMemo(self):
newmemo = self.memochooser.newmemoname()
selectedmemo = self.memochooser.selectedmemo()
time = unicode(self.memochooser.timeinput.text())
secret = self.memochooser.secretChannel.isChecked()
invite = self.memochooser.inviteChannel.isChecked()
if newmemo:
if self.memochooser.newmemoname():
newmemo = self.memochooser.newmemoname()
channel = "#"+unicode(newmemo).replace(" ", "_")
channel = re.sub(r"[^A-Za-z0-9#_]", "", channel)
self.newMemo(channel, time, secret=secret, invite=invite)
elif selectedmemo:
channel = "#"+unicode(selectedmemo.target)
for SelectedMemo in self.memochooser.SelectedMemos():
channel = "#"+unicode(SelectedMemo.target)
self.newMemo(channel, time)
self.memochooser = None
@QtCore.pyqtSlot()
def memoChooserClose(self):