Minimizable userlist in memos

This commit is contained in:
Kiooeht 2011-08-21 16:49:31 -07:00
parent 100e40c0bf
commit b9ca2569ce
6 changed files with 29 additions and 5 deletions

View file

@ -359,6 +359,12 @@ class PesterMemo(PesterConvo):
self.textInput = MemoInput(self.mainwindow.theme, self) self.textInput = MemoInput(self.mainwindow.theme, self)
self.textInput.setFocus() self.textInput.setFocus()
self.miniUserlist = QtGui.QPushButton(">\n>", self)
#self.miniUserlist.setStyleSheet("border:1px solid #a68168; border-width: 2px 0px 2px 2px; height: 90px; width: 10px; color: #cd8f9d; font-family: 'Arial'; background: white; margin-left: 2px;")
self.connect(self.miniUserlist, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('toggleUserlist()'))
self.userlist = RightClickList(self) self.userlist = RightClickList(self)
self.userlist.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)) self.userlist.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding))
self.userlist.optionsMenu = QtGui.QMenu(self) self.userlist.optionsMenu = QtGui.QMenu(self)
@ -449,6 +455,7 @@ class PesterMemo(PesterConvo):
layout_1 = QtGui.QHBoxLayout() layout_1 = QtGui.QHBoxLayout()
layout_1.addLayout(layout_0) layout_1.addLayout(layout_0)
layout_1.addWidget(self.miniUserlist)
layout_1.addWidget(self.userlist) layout_1.addWidget(self.userlist)
# layout_1 = QtGui.QGridLayout() # layout_1 = QtGui.QGridLayout()
@ -489,6 +496,17 @@ class PesterMemo(PesterConvo):
self.history = PesterHistory() self.history = PesterHistory()
self.applyquirks = True self.applyquirks = True
@QtCore.pyqtSlot()
def toggleUserlist(self):
if self.userlist.isHidden():
self.userlist.show()
self.miniUserlist.setText(">\n>")
self.miniUserlist.setStyleSheet("%s border-width: 2px 0px 2px 2px;" % self.miniUserlist.styleSheet())
else:
self.userlist.hide()
self.miniUserlist.setText("<\n<")
self.miniUserlist.setStyleSheet("%s border-width: 2px;" % self.miniUserlist.styleSheet())
def title(self): def title(self):
return self.channel return self.channel
def icon(self): def icon(self):
@ -542,6 +560,13 @@ class PesterMemo(PesterConvo):
else: else:
self.userlist.setStyleSheet("QListWidget { %s } QScrollBar { %s } QScrollBar::handle { %s }" % (theme["memos/userlist/style"], scrolls, "background-color: black;")) self.userlist.setStyleSheet("QListWidget { %s } QScrollBar { %s } QScrollBar::handle { %s }" % (theme["memos/userlist/style"], scrolls, "background-color: black;"))
self.userlist.setFixedWidth(theme["memos/userlist/width"]) self.userlist.setFixedWidth(theme["memos/userlist/width"])
if self.userlist.isHidden():
borders = "border-width: 2px;"
else:
borders = "border-width: 2px 0px 2px 2px;"
self.miniUserlist.setStyleSheet("%s padding: 0px; margin: 0px; margin-left: 5px; width: 10px; height: 90px; %s" % (theme["memos/userlist/style"], borders))
self.addchumAction.setText(theme["main/menus/rclickchumlist/addchum"]) self.addchumAction.setText(theme["main/menus/rclickchumlist/addchum"])
self.banuserAction.setText(theme["main/menus/rclickchumlist/banuser"]) self.banuserAction.setText(theme["main/menus/rclickchumlist/banuser"])
self.opAction.setText(theme["main/menus/rclickchumlist/opuser"]) self.opAction.setText(theme["main/menus/rclickchumlist/opuser"])

View file

@ -247,7 +247,7 @@
}, },
"margins": {"top": 10, "bottom": 10, "left": 9, "right": 4 }, "margins": {"top": 10, "bottom": 10, "left": 9, "right": 4 },
"userlist": { "width": 125, "userlist": { "width": 125,
"style": "font-size: 12px; background: white; margin-left: 5px; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);" "style": "font-size: 12px; background: white; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);"
}, },
"time": { "text": { "width": 75, "time": { "text": { "width": 75,
"style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;" "style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;"

View file

@ -244,7 +244,7 @@
}, },
"margins": {"top": 10, "bottom": 10, "left": 9, "right": 4 }, "margins": {"top": 10, "bottom": 10, "left": 9, "right": 4 },
"userlist": { "width": 125, "userlist": { "width": 125,
"style": "font-size: 12px; background: white; margin-left: 5px; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);" "style": "font-size: 12px; background: white; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);"
}, },
"time": { "text": { "width": 75, "time": { "text": { "width": 75,
"style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;" "style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;"

View file

@ -409,7 +409,7 @@
}, },
"margins": {"top": 10, "bottom": 10, "left": 9, "right": 4 }, "margins": {"top": 10, "bottom": 10, "left": 9, "right": 4 },
"userlist": { "width": 125, "userlist": { "width": 125,
"style": "font-size: 12px; background: white; margin-left: 5px; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);" "style": "font-size: 12px; background: white; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);"
}, },
"time": { "text": { "width": 75, "time": { "text": { "width": 75,
"style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;" "style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;"

View file

@ -329,7 +329,7 @@
}, },
"margins": {"top": 22, "bottom": 10, "left": 9, "right": 4 }, "margins": {"top": 22, "bottom": 10, "left": 9, "right": 4 },
"userlist": { "width": 125, "userlist": { "width": 125,
"style": "font-size: 12px; background: white; margin-left: 5px; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);" "style": "font-size: 12px; background: white; margin-bottom: 5px; border:2px solid #c2c2c2; padding: 5px; font-family: 'Arial';selection-background-color:rgb(200,200,200);"
}, },
"time": { "text": { "width": 75, "time": { "text": { "width": 75,
"style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;" "style": "color: black; font:bold; border:1px solid #c2c2c2; background: white; height: 19px;"

View file

@ -88,7 +88,6 @@ class ToastMachine(object):
if pynotify else if pynotify else
{'default' : DefaultToast}), {'default' : DefaultToast}),
extras={}): extras={}):
print types
self.mainwindow = parent self.mainwindow = parent
self.name = name self.name = name
types.update(extras) types.update(extras)