|
|
|
@ -36,8 +36,9 @@ def get_system_rgb(obj, pallete_type):
|
|
|
|
|
|
|
|
|
|
def dpivalue(size):
|
|
|
|
|
try:
|
|
|
|
|
return size * qt.QApplication.screen()[0].logicalDotsPerInch() / 96.0;
|
|
|
|
|
except BaseExeception as e:
|
|
|
|
|
return size * qt.QApplication.screens()[0].logicalDotsPerInch() / 96.0;
|
|
|
|
|
except BaseException as e:
|
|
|
|
|
print str(e)
|
|
|
|
|
if isinstance(e, KeyboardInterrupt):
|
|
|
|
|
raise
|
|
|
|
|
return size
|
|
|
|
@ -87,9 +88,9 @@ _('The user must not be root')
|
|
|
|
|
class TopMenu(qt.QPushButton):
|
|
|
|
|
def __init__(self, label, images, parent = None):
|
|
|
|
|
qt.QPushButton.__init__(self, parent)
|
|
|
|
|
self.setStyleSheet("QPushButton{border: none; margin: 1px;}"
|
|
|
|
|
self.setStyleSheet("QPushButton{border: none; margin: 0px;}"
|
|
|
|
|
"QPushButton:hover{border: 1px solid #73D1FF;"
|
|
|
|
|
"border-radius: 3px; margin: 1px;}")
|
|
|
|
|
"border-radius: 3px; margin: 0px;}")
|
|
|
|
|
# self.setStyleSheet("QPushButton{border: none; margin: 0px 0px 0px 0px;}"
|
|
|
|
|
# ":hover {border: 1px solid #73D1FF;"
|
|
|
|
|
# "border-radius: 3px; margin: 0px 0px 0px 0px;}"
|
|
|
|
@ -112,6 +113,7 @@ class TopMenu(qt.QPushButton):
|
|
|
|
|
|
|
|
|
|
self.image_lbl.setPixmap(pm2)
|
|
|
|
|
# self.image_lbl.adjustSize()
|
|
|
|
|
#self.image_lbl.setFixedHeight(dpivalue(24))
|
|
|
|
|
self.image_lbl.setAlignment(qt.Qt.AlignCenter)
|
|
|
|
|
|
|
|
|
|
# add transparency
|
|
|
|
@ -129,11 +131,11 @@ class TopMenu(qt.QPushButton):
|
|
|
|
|
self.lbl.setAttribute(qt.Qt.WA_NoSystemBackground)
|
|
|
|
|
|
|
|
|
|
self.layout.addWidget(self.lbl)
|
|
|
|
|
self.layout.setContentsMargins(2,4,2,2)
|
|
|
|
|
self.layout.setContentsMargins(2,4,2,4)
|
|
|
|
|
self.layout.setSpacing(0)
|
|
|
|
|
|
|
|
|
|
# self.setFixedSize(48,40)
|
|
|
|
|
self.setFixedHeight(48)
|
|
|
|
|
self.setFixedHeight(52)
|
|
|
|
|
if self.lbl.sizeHint().width() > 32:
|
|
|
|
|
self.setFixedWidth(self.lbl.sizeHint().width()+16)
|
|
|
|
|
else:
|
|
|
|
@ -144,12 +146,12 @@ class TopMenu(qt.QPushButton):
|
|
|
|
|
self.setAttribute(qt.Qt.WA_DeleteOnClose)
|
|
|
|
|
|
|
|
|
|
def mousePressEvent(self, event):
|
|
|
|
|
self.layout.setContentsMargins(2,5,2,2)
|
|
|
|
|
self.layout.setContentsMargins(2,5,2,4)
|
|
|
|
|
event.accept()
|
|
|
|
|
qt.QPushButton.mousePressEvent(self, event)
|
|
|
|
|
|
|
|
|
|
def mouseReleaseEvent(self, event):
|
|
|
|
|
self.layout.setContentsMargins(2,4,2,2)
|
|
|
|
|
self.layout.setContentsMargins(2,4,2,4)
|
|
|
|
|
event.accept()
|
|
|
|
|
qt.QPushButton.mouseReleaseEvent(self, event)
|
|
|
|
|
|
|
|
|
@ -158,8 +160,8 @@ class TopMenu(qt.QPushButton):
|
|
|
|
|
|
|
|
|
|
def setText(self, text):
|
|
|
|
|
self.lbl.setText(text)
|
|
|
|
|
self.setFixedHeight(48)
|
|
|
|
|
if self.lbl.sizeHint().width() > 32:
|
|
|
|
|
self.setFixedHeight(52)
|
|
|
|
|
if self.lbl.sizeHint().width() > 48:
|
|
|
|
|
self.setFixedWidth(self.lbl.sizeHint().width()+16)
|
|
|
|
|
else:
|
|
|
|
|
self.setFixedWidth(48)
|
|
|
|
@ -2222,7 +2224,7 @@ class ResultLayout(qt.QVBoxLayout):
|
|
|
|
|
self.addLayout(self.content)
|
|
|
|
|
|
|
|
|
|
self.kill_process_button = self._create_button(_('Break the process'))
|
|
|
|
|
self.kill_process_button.setFixedHeight(32)
|
|
|
|
|
self.kill_process_button.setFixedHeight(dpivalue(32))
|
|
|
|
|
parent._parent.control_button.set_break_button(self.kill_process_button)
|
|
|
|
|
|
|
|
|
|
def _addWidget(self, widget):
|
|
|
|
@ -2230,12 +2232,13 @@ class ResultLayout(qt.QVBoxLayout):
|
|
|
|
|
|
|
|
|
|
def _create_button(self, label, width=144):
|
|
|
|
|
button = qt.QPushButton(label)
|
|
|
|
|
button.setFixedWidth(width)
|
|
|
|
|
button.setFixedWidth(dpivalue(width))
|
|
|
|
|
button.setContentsMargins(0, 10, 0, 0)
|
|
|
|
|
button.setMinimumHeight(
|
|
|
|
|
button.minimumSizeHint().height())
|
|
|
|
|
button.setMaximumHeight(
|
|
|
|
|
button.minimumSizeHint().height())
|
|
|
|
|
button.setFixedHeight(dpivalue(32))
|
|
|
|
|
#button.setMinimumHeight(
|
|
|
|
|
# button.minimumSizeHint().height())
|
|
|
|
|
#button.setMaximumHeight(
|
|
|
|
|
# button.minimumSizeHint().height())
|
|
|
|
|
return button
|
|
|
|
|
|
|
|
|
|
def hide_kill_button(self):
|
|
|
|
|