|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
from calculate.consolegui import qt
|
|
|
|
|
|
|
|
|
|
from more import ButtonMenu, FlowLayout, get_sid, ClientServiceThread, \
|
|
|
|
|
get_view_params, show_msg, client_list_methods
|
|
|
|
|
get_view_params, show_msg, client_list_methods, get_system_rgb
|
|
|
|
|
|
|
|
|
|
class DisplayMethod(qt.QWidget):
|
|
|
|
|
def __init__(self, parent, ClientObj):
|
|
|
|
@ -41,40 +41,6 @@ class DisplayMethod(qt.QWidget):
|
|
|
|
|
# set new Title
|
|
|
|
|
self.ClientObj._parent.setWindowTitle(self.ClientObj.Name)
|
|
|
|
|
|
|
|
|
|
background_color = self.palette().color(qt.QPalette.Base)
|
|
|
|
|
background_color = background_color.getRgb()
|
|
|
|
|
background_color = "rgb%s"%str(background_color[0:3])
|
|
|
|
|
|
|
|
|
|
#text_color = self.palette().color(qt.QPalette.Text)
|
|
|
|
|
#text_color = text_color.getRgb()
|
|
|
|
|
#text_color = "rgb%s"%str(text_color[0:3])
|
|
|
|
|
text_color = "rgb(160,160,160)"
|
|
|
|
|
|
|
|
|
|
self._parent.main_frame.viewport().setStyleSheet(
|
|
|
|
|
"background-color: %s ; " %background_color
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.setStyleSheet(self.styleSheet() + \
|
|
|
|
|
'QWidget { background: transparent;}'
|
|
|
|
|
|
|
|
|
|
'QGroupBox {font-weight: bold;'
|
|
|
|
|
'border: 1px solid gray;'
|
|
|
|
|
'border-left-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-top-color: qlineargradient( x1: 0, y1: 0, x2: 1, y2: 0,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-right: 0px; border-bottom: 0px;'
|
|
|
|
|
'border-top-left-radius: 2px;'
|
|
|
|
|
|
|
|
|
|
'background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1,'
|
|
|
|
|
'stop: 0 rgba(200, 200, 200,75), stop: 0.5 transparent,'
|
|
|
|
|
'stop: 1 transparent);'
|
|
|
|
|
'padding-top: 18px; padding-bottom: 18px;}'
|
|
|
|
|
'QGroupBox::title {background-color: transparent;'
|
|
|
|
|
|
|
|
|
|
'color: %s; subcontrol-position: top left;'
|
|
|
|
|
'margin-top: 6px; margin-left: 8px;}'%text_color)
|
|
|
|
|
|
|
|
|
|
# transform a list into the dictionary {'group': [methods], ...}
|
|
|
|
|
guiMethods = {}
|
|
|
|
|
if type(results) == int:
|
|
|
|
@ -210,6 +176,44 @@ class DisplayMethod(qt.QWidget):
|
|
|
|
|
self.layout.setAlignment(qt.Qt.AlignTop)
|
|
|
|
|
self.setLayout(self.layout)
|
|
|
|
|
self.resize(self.layout.sizeHint())
|
|
|
|
|
self.updateColors()
|
|
|
|
|
|
|
|
|
|
def updateColors(self):
|
|
|
|
|
background_color = get_system_rgb(self._parent.main_frame, qt.QPalette.Base)
|
|
|
|
|
self._parent.main_frame.viewport().setStyleSheet(
|
|
|
|
|
"background-color: %s ; " %background_color
|
|
|
|
|
)
|
|
|
|
|
text_color = "rgb(160,160,160)"
|
|
|
|
|
self.setStyleSheet(self.styleSheet() + \
|
|
|
|
|
'QWidget { background: transparent;}'
|
|
|
|
|
|
|
|
|
|
'QGroupBox {font-weight: bold;'
|
|
|
|
|
'border: 1px solid gray;'
|
|
|
|
|
'border-left-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-top-color: qlineargradient( x1: 0, y1: 0, x2: 1, y2: 0,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-right: 0px; border-bottom: 0px;'
|
|
|
|
|
'border-top-left-radius: 2px;'
|
|
|
|
|
|
|
|
|
|
'background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1,'
|
|
|
|
|
'stop: 0 rgba(200, 200, 200,75), stop: 0.5 transparent,'
|
|
|
|
|
'stop: 1 transparent);'
|
|
|
|
|
'padding-top: 18px; padding-bottom: 18px;}'
|
|
|
|
|
'QGroupBox::title {background-color: transparent;'
|
|
|
|
|
|
|
|
|
|
'color: %s; subcontrol-position: top left;'
|
|
|
|
|
'margin-top: 6px; margin-left: 8px;}'%text_color)
|
|
|
|
|
|
|
|
|
|
for group in self.button_list.values():
|
|
|
|
|
for button in group:
|
|
|
|
|
button.updateColors()
|
|
|
|
|
|
|
|
|
|
def disableButtons(self):
|
|
|
|
|
for group in self.button_list.values():
|
|
|
|
|
for button in group:
|
|
|
|
|
button.setEnabled(False)
|
|
|
|
|
button.updateColors()
|
|
|
|
|
|
|
|
|
|
def refresh(self):
|
|
|
|
|
self.ClientObj.methods_list = client_list_methods(self.ClientObj.sid,
|
|
|
|
@ -222,12 +226,14 @@ class DisplayMethod(qt.QWidget):
|
|
|
|
|
self._parent.main_frame.viewport().palette()
|
|
|
|
|
self.ClientObj._parent.setWindowTitle(_("Calculate Console"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def onActivated(self):
|
|
|
|
|
# Call server method
|
|
|
|
|
if hasattr (self, 'onActivated_thread'):
|
|
|
|
|
if self.onActivated_thread.isRunning():
|
|
|
|
|
return 1
|
|
|
|
|
self.setDisabled(True)
|
|
|
|
|
self.setEnabled(False)
|
|
|
|
|
self.updateColors()
|
|
|
|
|
method_name = self.sender().objectName()
|
|
|
|
|
# view_method_name = self.sender().text()
|
|
|
|
|
step = 0
|
|
|
|
|