Exemplo n.º 1
0
Arquivo: icons.py Projeto: dodo/blain
 def do_mask_on_(self, msg):
     # set mask for given msg
     if self.avatar_mask is None:
         msg.avatarLabel.setStyleSheet(patchStyleSheet(
             msg.avatarLabel.styleSheet(),
             **{'background-color':"black", 'color':"black"}))
         msg.avatarContainer.setStyleSheet(patchStyleSheet(
             msg.avatarContainer.styleSheet(),
             **{'background-color':"red", 'color':"red"}))
         self.avatar_mask = QPixmap.grabWidget(msg.avatarContainer).\
             createMaskFromColor(QColor("red"))
         msg.avatarContainer.setStyleSheet(patchStyleSheet(
             msg.avatarContainer.styleSheet(),
             **{'background-color':None, 'color':None}))
     msg.avatarLabel.setMask(self.avatar_mask)
Exemplo n.º 2
0
Arquivo: main.py Projeto: dodo/blain
 def build_message_item(self, blob):
     pref = self.app.preferences
     msg = self.Message.new()
     msg.id.setVisible(False)
     if blob.reply is None:
         msg.replyLabel.setVisible(False)
     msg.id.setText(str(blob.pid))
     pal = self.app.palette()
     msg.messageLabel.setText(
         "<style>a {text-decoration:none}</style>" + blob.text)
     msg.infoLabel.setText("<style>a {text-decoration:none;color:" +
         pal.dark().color().name() + "}</style>" + blob.info)
     msg.infoLabel.setStyleSheet(patchStyleSheet(
         msg.infoLabel.styleSheet(), color = pal.mid().color().name()))
     for label, fg, bg in [(msg.repeatLabel,
                    pal.highlightedText().color().name(),
                    pal.highlight().color().name()),
                   (msg.replyLabel,
                    pal.window().color().name(),
                    pal.mid().color().name())]:
         x = label.minimumSizeHint().height()
         label.setMinimumSize(x, x)
         label.setMaximumSize(x, x)
         label.setStyleSheet(patchStyleSheet(
             label.styleSheet(), **{'background-color':bg, 'color':fg}))
     if blob.unread:
         msg.messageLabel.setStyleSheet(patchStyleSheet(
             msg.messageLabel.styleSheet(),
             **{'background-color':pref.bgcolor.name(),
                'color':pref.fgcolor.name()}))
     self.app.icons.do_mask_on_(msg)
     msg.avatarLabel.setStyleSheet(patchStyleSheet(
         msg.avatarLabel.styleSheet(),
         **{'background-color':blob.author_bgcolor,
            'color':blob.author_fgcolor}))
     self.app.icons.do_service_icon_on_(msg, blob.service)
     if blob.author_id == blob.user_id:
         msg.repeatLabel.setVisible(False)
     else:
         style = {'background-color':blob.user_bgcolor,
                  'color':blob.user_fgcolor}
         if 'imageinfo' in blob.__dict__ and 'user' in blob.imageinfo:
             style['border-radius'] = "0em"
         msg.repeatLabel.setStyleSheet(patchStyleSheet(
             msg.repeatLabel.styleSheet(), **style))
     if 'imageinfo' in blob.__dict__:
         self.app.icons.do_avatar_on_(msg, blob.imageinfo)
     return msg, blob.time.strftime("%Y-%m-%d %H:%M:%S")
Exemplo n.º 3
0
 def mark_as_read(self):
     mt = self.app.window.ui.messageTable
     msg = mt.itemWidget(mt.currentItem(), 0)
     if "color" in msg.messageLabel.styleSheet():
         self.app.db.set_unread_status(int(msg.id.text()), False)
         msg.messageLabel.setStyleSheet(patchStyleSheet(
             msg.messageLabel.styleSheet(),
             **{'background-color':None, 'color':None}))
         self.update()
Exemplo n.º 4
0
 def work(item):
     msg = mt.itemWidget(item, 0)
     msg.messageLabel.setStyleSheet(patchStyleSheet(
         msg.messageLabel.styleSheet(), **properties))
Exemplo n.º 5
0
Arquivo: main.py Projeto: koeart/blain
 def work(item):
     msg = mt.itemWidget(item, 0)
     if ids is not None and int(msg.id.text()) not in ids:
         return # skip it
     msg.messageLabel.setStyleSheet(patchStyleSheet(
         msg.messageLabel.styleSheet(), **properties))