|
|
@ -194,7 +194,17 @@ class HelpMenu(TopMenu):
|
|
|
|
TopMenu.mouseReleaseEvent(self, event)
|
|
|
|
TopMenu.mouseReleaseEvent(self, event)
|
|
|
|
|
|
|
|
|
|
|
|
class ButtonMenu(QtGui.QPushButton):
|
|
|
|
class ButtonMenu(QtGui.QPushButton):
|
|
|
|
def __init__(self, name, label, images, parent):
|
|
|
|
|
|
|
|
|
|
|
|
def statusIcon(self, emblem, size):
|
|
|
|
|
|
|
|
status_icons = {'complete':('process-completed-symbolic',),
|
|
|
|
|
|
|
|
'warning': ('process-error-symbolic',),
|
|
|
|
|
|
|
|
'question': ('dialog-question',),
|
|
|
|
|
|
|
|
'process': ('clock',)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for icon in status_icons.get(emblem,['']):
|
|
|
|
|
|
|
|
return QtGui.QIcon.fromTheme(icon).pixmap(size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, name, label, images, emblem=None, parent=None):
|
|
|
|
QtGui.QPushButton.__init__(self, parent)
|
|
|
|
QtGui.QPushButton.__init__(self, parent)
|
|
|
|
self.layout = QtGui.QVBoxLayout(self)
|
|
|
|
self.layout = QtGui.QVBoxLayout(self)
|
|
|
|
self.layout.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
|
|
|
|
self.layout.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
|
|
|
@ -211,25 +221,35 @@ class ButtonMenu(QtGui.QPushButton):
|
|
|
|
icon = QtGui.QIcon.fromTheme(image)
|
|
|
|
icon = QtGui.QIcon.fromTheme(image)
|
|
|
|
if not icon.isNull():
|
|
|
|
if not icon.isNull():
|
|
|
|
pm2 = icon.pixmap(128)
|
|
|
|
pm2 = icon.pixmap(128)
|
|
|
|
icon_flag = False
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
elif os.path.isfile(image):
|
|
|
|
elif os.path.isfile(image):
|
|
|
|
ir = QtGui.QImageReader(image)
|
|
|
|
ir = QtGui.QImageReader(image)
|
|
|
|
ir.setScaledSize(QtCore.QSize(32, 32))
|
|
|
|
ir.setScaledSize(QtCore.QSize(32, 32))
|
|
|
|
img = ir.read()
|
|
|
|
img = ir.read()
|
|
|
|
pm2 = QtGui.QPixmap().fromImage(img)
|
|
|
|
pm2 = QtGui.QPixmap().fromImage(img)
|
|
|
|
|
|
|
|
|
|
|
|
icon_flag = False
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
if icon_flag:
|
|
|
|
else:
|
|
|
|
icon = QtGui.QIcon.fromTheme('applications-system')
|
|
|
|
icon = QtGui.QIcon.fromTheme('applications-system')
|
|
|
|
pm2 = icon.pixmap(32)
|
|
|
|
pm2 = icon.pixmap(32)
|
|
|
|
|
|
|
|
|
|
|
|
pm2 = pm2.scaled(QtCore.QSize(32,32), QtCore.Qt.IgnoreAspectRatio, \
|
|
|
|
pm2 = pm2.scaled(QtCore.QSize(32,32), QtCore.Qt.IgnoreAspectRatio, \
|
|
|
|
QtCore.Qt.SmoothTransformation)
|
|
|
|
QtCore.Qt.SmoothTransformation)
|
|
|
|
|
|
|
|
|
|
|
|
self.image_lbl.setPixmap(pm2)
|
|
|
|
if emblem:
|
|
|
|
self.image_lbl.setMinimumHeight(32)
|
|
|
|
icon_size = 40
|
|
|
|
|
|
|
|
emblem_size = 18
|
|
|
|
|
|
|
|
pixmap = QtGui.QPixmap(icon_size,icon_size)
|
|
|
|
|
|
|
|
pixmap.fill(QtCore.Qt.transparent)
|
|
|
|
|
|
|
|
painter = QtGui.QPainter(pixmap)
|
|
|
|
|
|
|
|
painter.drawPixmap(0,0,pm2)
|
|
|
|
|
|
|
|
painter.drawPixmap(icon_size-emblem_size,(icon_size-emblem_size)*0.7,
|
|
|
|
|
|
|
|
self.statusIcon(emblem, emblem_size))
|
|
|
|
|
|
|
|
self.image_lbl.setPixmap(pixmap)
|
|
|
|
|
|
|
|
painter.end()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.image_lbl.setPixmap(pm2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.image_lbl.setMinimumHeight(48)
|
|
|
|
self.image_lbl.setAlignment(QtCore.Qt.AlignHCenter)
|
|
|
|
self.image_lbl.setAlignment(QtCore.Qt.AlignHCenter)
|
|
|
|
|
|
|
|
|
|
|
|
# add transparency
|
|
|
|
# add transparency
|
|
|
@ -241,7 +261,7 @@ class ButtonMenu(QtGui.QPushButton):
|
|
|
|
if not label:
|
|
|
|
if not label:
|
|
|
|
label = name
|
|
|
|
label = name
|
|
|
|
self.lbl = LabelWordWrap(label, self)
|
|
|
|
self.lbl = LabelWordWrap(label, self)
|
|
|
|
self.lbl.setFixedHeight(30)
|
|
|
|
self.lbl.setFixedHeight(32)
|
|
|
|
self.lbl.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
|
|
|
|
self.lbl.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
|
|
|
|
self.lbl.resize(self.lbl.sizeHint())
|
|
|
|
self.lbl.resize(self.lbl.sizeHint())
|
|
|
|
self.lbl.setStyleSheet("QLabel {border: None;}")
|
|
|
|
self.lbl.setStyleSheet("QLabel {border: None;}")
|
|
|
@ -261,6 +281,8 @@ class ButtonMenu(QtGui.QPushButton):
|
|
|
|
"border-radius: 7px;}"
|
|
|
|
"border-radius: 7px;}"
|
|
|
|
"QPushButton:hover:!pressed{background-color: "
|
|
|
|
"QPushButton:hover:!pressed{background-color: "
|
|
|
|
"rgb(230,230,230); border-radius: 7px;}")
|
|
|
|
"rgb(230,230,230); border-radius: 7px;}")
|
|
|
|
|
|
|
|
if emblem == 'disable':
|
|
|
|
|
|
|
|
self.setDisabled(True)
|
|
|
|
self.updateGeometry()
|
|
|
|
self.updateGeometry()
|
|
|
|
|
|
|
|
|
|
|
|
def text(self):
|
|
|
|
def text(self):
|
|
|
@ -2491,8 +2513,13 @@ def post_connect_action(client, ClientObj):
|
|
|
|
icon_visible(ClientObj.MainWidget, 'Connect', False)
|
|
|
|
icon_visible(ClientObj.MainWidget, 'Connect', False)
|
|
|
|
icon_visible(ClientObj.MainWidget, 'Certificates', False)
|
|
|
|
icon_visible(ClientObj.MainWidget, 'Certificates', False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read_root_methods(client, ClientObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def read_root_methods(client, ClientObj):
|
|
|
|
ClientObj.methods_list = client_list_methods(ClientObj.sid, client)
|
|
|
|
ClientObj.methods_list = client_list_methods(ClientObj.sid, client)
|
|
|
|
if ClientObj.methods_list == 1:
|
|
|
|
ClientObj.cwd = []
|
|
|
|
|
|
|
|
if ClientObj.methods_list is None:
|
|
|
|
show_msg (_('No methods available!'), parent = ClientObj.MainWidget)
|
|
|
|
show_msg (_('No methods available!'), parent = ClientObj.MainWidget)
|
|
|
|
ClientObj.MainWidget.disconnect(True)
|
|
|
|
ClientObj.MainWidget.disconnect(True)
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
@ -2547,23 +2574,21 @@ def client_del_sid(client):
|
|
|
|
|
|
|
|
|
|
|
|
def client_list_methods(sid, client):
|
|
|
|
def client_list_methods(sid, client):
|
|
|
|
""" get & show all available methods for this certificate """
|
|
|
|
""" get & show all available methods for this certificate """
|
|
|
|
DAT = 0 # Access to data soap structure
|
|
|
|
|
|
|
|
RES = 0 # Access to result
|
|
|
|
|
|
|
|
COM = 0 # Getting command group
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
results = client.service.get_methods(sid, 'gui')
|
|
|
|
results = client.service.get_methods(sid, 'gui')
|
|
|
|
except urllib2.URLError, e:
|
|
|
|
except urllib2.URLError, e:
|
|
|
|
_print ('client.service.get_methods in client_list_methods Exception')
|
|
|
|
_print ('client.service.get_methods in client_list_methods Exception')
|
|
|
|
return 1
|
|
|
|
return None
|
|
|
|
if not results:
|
|
|
|
# старый протокол
|
|
|
|
return 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if results[DAT][RES][RES][COM] == '0':
|
|
|
|
results[0][0].name
|
|
|
|
return 1
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
return None
|
|
|
|
return results[DAT]
|
|
|
|
if results[0][0][0][0] == 1:
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
if not results:
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
return results[0]
|
|
|
|
|
|
|
|
|
|
|
|
# get session id
|
|
|
|
# get session id
|
|
|
|
def get_sid (client):
|
|
|
|
def get_sid (client):
|
|
|
|