|
|
|
@ -35,6 +35,9 @@ def get_system_rgb(obj, pallete_type):
|
|
|
|
|
color = obj.palette().color(pallete_type).getRgb()
|
|
|
|
|
return "rgb%s"%str(color[0:3])
|
|
|
|
|
|
|
|
|
|
def alphed(rgbstr, value):
|
|
|
|
|
return rgbstr.replace(")", ",%d)"%value)
|
|
|
|
|
|
|
|
|
|
_('The user must not be root')
|
|
|
|
|
class TopMenu(QtGui.QPushButton):
|
|
|
|
|
def __init__(self, label, images, parent = None):
|
|
|
|
@ -264,16 +267,32 @@ class ButtonMenu(QtGui.QPushButton):
|
|
|
|
|
|
|
|
|
|
# rgb(218,218,218)
|
|
|
|
|
# rgb(230,230,230)
|
|
|
|
|
self.setStyleSheet("QPushButton:flat {border: None;}"
|
|
|
|
|
"QPushButton:hover:pressed {border: none;"
|
|
|
|
|
"background-color: %s;"
|
|
|
|
|
"border-radius: 7px;}"
|
|
|
|
|
"QPushButton:hover:!pressed{background-color: "
|
|
|
|
|
"%s; border-radius: 7px;}"%
|
|
|
|
|
(get_system_rgb(self, QtGui.QPalette.Link),
|
|
|
|
|
get_system_rgb(self, QtGui.QPalette.Highlight)))
|
|
|
|
|
self.setStyleSheet(
|
|
|
|
|
"QPushButton:flat {border: None;}"
|
|
|
|
|
"QPushButton:hover:pressed {border: none;"
|
|
|
|
|
"background-color: %s;"
|
|
|
|
|
"border-radius: 7px;}"
|
|
|
|
|
"QPushButton:hover:!pressed {background-color: "
|
|
|
|
|
"%s; border-radius: 7px;}" %
|
|
|
|
|
(alphed(get_system_rgb(self, QtGui.QPalette.Highlight),255),
|
|
|
|
|
alphed(get_system_rgb(self, QtGui.QPalette.Highlight),100)))
|
|
|
|
|
self.updateGeometry()
|
|
|
|
|
|
|
|
|
|
def mousePressEvent(self, *args, **kwargs):
|
|
|
|
|
self.lbl.setStyleSheet("QLabel {border: None; color: %s;}"%
|
|
|
|
|
get_system_rgb(self, QtGui.QPalette.HighlightedText))
|
|
|
|
|
return super(ButtonMenu, self).mousePressEvent(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
def enterEvent(self, *args, **kwargs):
|
|
|
|
|
self.lbl.setStyleSheet("QLabel {border: None; color: %s;}"%
|
|
|
|
|
get_system_rgb(self, QtGui.QPalette.Text))
|
|
|
|
|
return super(ButtonMenu, self).enterEvent(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
def leaveEvent(self, *args, **kwargs):
|
|
|
|
|
self.lbl.setStyleSheet("QLabel {border: None; color: %s;}"%
|
|
|
|
|
get_system_rgb(self, QtGui.QPalette.Text))
|
|
|
|
|
return super(ButtonMenu, self).leaveEvent(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
def text(self):
|
|
|
|
|
return self.lbl.text()
|
|
|
|
|
|
|
|
|
|