Перевод импорта элеменов Qt на wrapper

master-3.5
parent 552ba47f66
commit e7566bdc65

@ -2,7 +2,7 @@
#-*- coding: utf-8 -*-
import sys, os, pwd
from PySide import QtGui
from calculate.consolegui.qtwrapper import QtGuiWidgets
from calculate.consolegui.application.more import getRunProc, owner, _print
import __builtin__
@ -16,16 +16,6 @@ setLocalTranslate('console_gui',sys.modules[__name__])
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
#KeyboardInterrupt
#def sigint_handler(*args):
# """Handler for the SIGINT signal."""
# sys.stderr.write('\r')
# from PySide.QtGui import QMessageBox
# if QMessageBox.question(None, '', "Are you sure you want to quit?",
# QMessageBox.Yes | QMessageBox.No,
# QMessageBox.No) == QMessageBox.Yes:
# QtGui.QApplication.quit()
#signal.signal(signal.SIGINT, sigint_handler)
def main():
from calculate.consolegui.application.ConnectionTabs import (ToolTabWidget,
@ -43,7 +33,7 @@ def main():
if sym_link != 'cl-console-gui' and sym_link.startswith("cl-console-gui-"):
args.method = sym_link[len("cl-console-gui-"):].replace("-","_")
if args.method:
app = QtGui.QApplication(sys.argv)
app = QtGuiWidgets.QApplication(sys.argv)
app.setQuitOnLastWindowClosed(True)
ex = SelectedMethodWgt(app, args)
if args.method == 'update':
@ -82,7 +72,7 @@ def main():
except dbus.DBusException:
pass
app = QtGui.QApplication(sys.argv)
app = QtGuiWidgets.QApplication(sys.argv)
second = False
for run_commands in filter(lambda x:'cl-console-gui' in x[0],getRunProc()):

@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from PySide.QtGui import QMessageBox
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
import urllib2
from DisplayMethod import DisplayMethod, StartWidget, ConnectLostLabel
@ -44,9 +43,9 @@ def debug(level, *args):
print s,
print
class MainWgt(QtGui.QMainWindow):
class MainWgt(QtGuiWidgets.QMainWindow):
def __init__(self, ClientObj):
QtGui.QMainWindow.__init__(self)
QtGuiWidgets.QMainWindow.__init__(self)
self.ClientObj = ClientObj
self.initUI()
@ -54,16 +53,16 @@ class MainWgt(QtGui.QMainWindow):
# Create bottom status bar
# self.statusbar = self.statusBar()
self.Main = QtGui.QWidget(self)
self.Main = QtGuiWidgets.QWidget(self)
self.vlayout = QtGui.QVBoxLayout(self.Main)
self.vlayout = QtGuiWidgets.QVBoxLayout(self.Main)
# Create top main menu
self.topmenu = MainMenu(self)
self.vlayout.addWidget(self.topmenu)
self.layout_wgt = QtGui.QWidget(self)
self.layout = QtGui.QGridLayout(self.layout_wgt)
self.layout_wgt = QtGuiWidgets.QWidget(self)
self.layout = QtGuiWidgets.QGridLayout(self.layout_wgt)
self.layout.setAlignment(QtCore.Qt.AlignLeft)
# add control button widget
@ -76,8 +75,8 @@ class MainWgt(QtGui.QMainWindow):
self.left_frame.hide()
# Main Frame
self.main_frame = QtGui.QScrollArea(self)
self.main_frame.setFrameShape(QtGui.QFrame.Shape.NoFrame)
self.main_frame = QtGuiWidgets.QScrollArea(self)
self.main_frame.setFrameShape(QtGuiWidgets.QFrame.Shape.NoFrame)
self.main_frame.setObjectName('MF')
#self.main_frame.setStyleSheet("#MF " "{background-color: #FFFFFF;}")
@ -127,7 +126,7 @@ class MainWgt(QtGui.QMainWindow):
site = "http://www.calculate-linux.ru/main/ru/calculate-console-gui"
else:
site = "http://www.calculate-linux.org/main/en/calculate-console-gui"
QtGui.QDesktopServices.openUrl(QtCore.QUrl(site))
QtGuiWidgets.QDesktopServices.openUrl(QtCore.QUrl(site))
def bug_report(self):
self.bugWidget = BugWgt(self)
@ -208,22 +207,22 @@ class MainWgt(QtGui.QMainWindow):
return 1
if new_session:
reply = QtGui.QMessageBox.Yes
reply = QtGuiWidgets.QMessageBox.Yes
else:
reply = self.show_close_messagebox()
if reply in [QtGui.QMessageBox.No, QtGui.QMessageBox.Yes]:
if reply in [QtGuiWidgets.QMessageBox.No, QtGuiWidgets.QMessageBox.Yes]:
if hasattr(self.ClientObj, 'signaling'):
if self.ClientObj.signaling.isRunning():
self.ClientObj.signaling.close()
self.ClientObj.signaling.wait()
if reply == QtGui.QMessageBox.Yes:
if reply == QtGuiWidgets.QMessageBox.Yes:
# Exit with closing session
client_del_sid(self.ClientObj.client)
self.ClientObj.param_objects = {}
if reply in [QtGui.QMessageBox.No, QtGui.QMessageBox.Yes]:
if reply in [QtGuiWidgets.QMessageBox.No, QtGuiWidgets.QMessageBox.Yes]:
if not self.topmenu.Processes.isEnabled():
self.topmenu.Processes.setEnabled(True)
self.topmenu.Session.setEnabled(True)
@ -413,7 +412,7 @@ class MainWgt(QtGui.QMainWindow):
def show_close_messagebox(self):
list_pid = client_list_pid(self.ClientObj.client)
msgBox = QMessageBox(self)
msgBox = QtGuiWidgets.QMessageBox(self)
msgBox.setWindowTitle(_('Closing session'))
msgBox.setText(_("Close this session") + ' ' + _('with %s?') \
% self.ClientObj.host_name + '\t')
@ -427,16 +426,16 @@ class MainWgt(QtGui.QMainWindow):
'data on process %d will be lost!') % len(
list_pid))
msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No | \
QMessageBox.Cancel)
msgBox.setStandardButtons(QtGuiWidgets.QMessageBox.Yes | QtGuiWidgets.QMessageBox.No | \
QtGuiWidgets.QMessageBox.Cancel)
# translate
msgBox.button(msgBox.Yes).setText(_('Yes'))
msgBox.button(msgBox.No).setText(_('No'))
msgBox.button(msgBox.Cancel).setText(_('Cancel'))
msgBox.setDefaultButton(QMessageBox.Cancel)
msgBox.setWindowIcon(QtGui.QIcon.fromTheme("application-exit"))
msgBox.setDefaultButton(QtGuiWidgets.QMessageBox.Cancel)
msgBox.setWindowIcon(QtGuiWidgets.QIcon.fromTheme("application-exit"))
reply = msgBox.exec_()
return reply
@ -444,7 +443,7 @@ class MainWgt(QtGui.QMainWindow):
if self.ClientObj.client:
reply = self.show_close_messagebox()
if reply == QtGui.QMessageBox.Yes or reply == QtGui.QMessageBox.No:
if reply == QtGuiWidgets.QMessageBox.Yes or reply == QtGuiWidgets.QMessageBox.No:
self.topmenu.Processes.setEnabled(True)
self.topmenu.Session.setEnabled(True)
self.topmenu.Back.setEnabled(True)
@ -462,7 +461,7 @@ class MainWgt(QtGui.QMainWindow):
['127.0.0.1', 'localhost']:
self.ClientObj._parent.set_localhost(None)
if reply == QtGui.QMessageBox.Yes:
if reply == QtGuiWidgets.QMessageBox.Yes:
# Closing session
client_del_sid(self.ClientObj.client)
return 1
@ -475,4 +474,4 @@ class MainWgt(QtGui.QMainWindow):
if e.key() == QtCore.Qt.Key_Return:
self.control_button.keyPressEvent(e)
else:
QtGui.QMainWindow.keyPressEvent(self, e)
QtGuiWidgets.QMainWindow.keyPressEvent(self, e)

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
import urllib2
import OpenSSL, hashlib
@ -23,46 +23,46 @@ from create_cert import RequestCreate
from client_class import HTTPSClientCertTransport, Client_suds
import os
class CertClass (QtGui.QWidget):
class CertClass (QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj, window):
self.ClientObj = ClientObj
QtGui.QWidget.__init__(self)
QtGuiWidgets.QWidget.__init__(self)
# get_cert_path
self.default_cert_path = ClientObj.path_to_cert
# self.default_cert_path = self.default_cert_path.replace("~",homePath)
self.sendlayout = QtGui.QGridLayout()
self.sendlayout = QtGuiWidgets.QGridLayout()
self.sendlayout.setContentsMargins(8,8,8,8)
self.mainlayout = QtGui.QVBoxLayout()
self.mainlayout = QtGuiWidgets.QVBoxLayout()
# gen ceth by host
self.sendlayout.addWidget(LabelWordWrap(_('Host'), self), 0,0)
self.send_host = QtGui.QLineEdit('localhost', self)
self.send_host = QtGuiWidgets.QLineEdit('localhost', self)
self.sendlayout.addWidget(self.send_host, 0, 1, 1, 2)
self.sendlayout.addWidget(LabelWordWrap(_('Port'), self), 1,0)
cl_core_port = self.ClientObj.VarsApi.Get('core.cl_core_port')
self.send_port = QtGui.QLineEdit(cl_core_port, self)
self.send_port.setValidator(QtGui.QIntValidator(self))
self.send_port = QtGuiWidgets.QLineEdit(cl_core_port, self)
self.send_port.setValidator(QtGuiWidgets.QIntValidator(self))
self.sendlayout.addWidget(self.send_port, 1, 1, 1, 2)
layout_button = QtGui.QHBoxLayout()
layout_button = QtGuiWidgets.QHBoxLayout()
Send_button = QtGui.QPushButton(_("Send a request"), self)
Send_button = QtGuiWidgets.QPushButton(_("Send a request"), self)
# Send_button.setFixedWidth(140)
Send_button.clicked.connect(self.send)
layout_button.addWidget(Send_button)
Get_button = QtGui.QPushButton(_("Get the certificate"), self)
Get_button = QtGuiWidgets.QPushButton(_("Get the certificate"), self)
# Get_button.setFixedWidth(140)
Get_button.clicked.connect(self.get)
layout_button.addWidget(Get_button)
Quit_button = QtGui.QPushButton(_("Quit"), self)
Quit_button = QtGuiWidgets.QPushButton(_("Quit"), self)
# Quit_button.setFixedWidth(60)
Quit_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
Quit_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
Quit_button.clicked.connect(self.close)
layout_button.addWidget(Quit_button)
@ -71,7 +71,7 @@ class CertClass (QtGui.QWidget):
self.sendlayout.setColumnStretch(1,1)
self.sendlayout.setColumnStretch(2,1)
self.GroupBoxSend = QtGui.QGroupBox(_("Certificate signature request"))
self.GroupBoxSend = QtGuiWidgets.QGroupBox(_("Certificate signature request"))
# self.GroupBoxSend.setContentsMargins(10,0,0,0)
self.GroupBoxSend.setLayout(self.sendlayout)
@ -88,7 +88,7 @@ class CertClass (QtGui.QWidget):
- self.size().height() / 2 - 50)
self.setWindowTitle (_('Certificates'))
self.setWindowIcon (QtGui.QIcon.fromTheme("view-certificate"))
self.setWindowIcon (QtGuiWidgets.QIcon.fromTheme("view-certificate"))
def send(self):
### client_post_request analog
@ -116,10 +116,10 @@ class CertClass (QtGui.QWidget):
reply = show_question(self, text, informative_text,
title = _('Calculate Console'))
if reply == QtGui.QMessageBox.No:
if reply == QtGuiWidgets.QMessageBox.No:
return 0
elif reply == QtGui.QMessageBox.Yes:
elif reply == QtGuiWidgets.QMessageBox.Yes:
pass
url = "https://%s:%d/?wsdl" %(by_host, int(port))
@ -159,12 +159,12 @@ class CertClass (QtGui.QWidget):
reply = show_question(self, text, informative_text,
title = _('Calculate Console'))
if reply == QtGui.QMessageBox.Yes:
if reply == QtGuiWidgets.QMessageBox.Yes:
self.req_obj = RequestCreate(self, self.ClientObj, key, \
cert_path, server_host_name)
self.req_obj.show()
elif reply == QtGui.QMessageBox.No:
elif reply == QtGuiWidgets.QMessageBox.No:
pass
else:

@ -18,7 +18,7 @@ import dbus
import dbus.service
import dbus.mainloop.glib
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
import sudsds, time, sys
import os, pwd, shutil
import ConfigParser
@ -32,9 +32,9 @@ from pid_information import client_pid_info
#from calculate.lib.cl_lang import setLocalTranslate
#setLocalTranslate('console_gui',sys.modules[__name__])
class SelectedMethodWgt(QtGui.QWidget):
class SelectedMethodWgt(QtGuiWidgets.QWidget):
def __init__(self, app, args):
QtGui.QWidget.__init__(self)
QtGuiWidgets.QWidget.__init__(self)
self.args = args
self.user_changed_flag = False
self.lang = args.lang
@ -50,18 +50,18 @@ class SelectedMethodWgt(QtGui.QWidget):
self.port = args.port or self.VarsGui.GetInteger('core.cl_core_port')
self.MethodWidget = self.ClientObj.MainWidget
self.MethodWidget.topmenu.hide()
layout = QtGui.QHBoxLayout(self)
layout = QtGuiWidgets.QHBoxLayout(self)
layout.setContentsMargins(0,0,0,0)
layout.setSpacing(0)
layout.addWidget(self.MethodWidget)
QtGui.QIcon.setThemeName('Calculate')
icon = QtGui.QIcon.fromTheme('cl-console-gui-%s'%self.method.replace("_","-"))
QtGuiWidgets.QIcon.setThemeName('Calculate')
icon = QtGuiWidgets.QIcon.fromTheme('cl-console-gui-%s'%self.method.replace("_","-"))
if icon.isNull():
icon = QtGui.QIcon.fromTheme('calculate-%s'%self.method.replace("_","-"))
icon = QtGuiWidgets.QIcon.fromTheme('calculate-%s'%self.method.replace("_","-"))
self.setWindowIcon(icon)
QtGui.QApplication.setWindowIcon(icon)
QtGuiWidgets.QApplication.setWindowIcon(icon)
conf_path = self.VarsGui.Get('cl_gui_config_path')
homePath = self.VarsGui.Get('ur_home_path')
@ -160,12 +160,12 @@ class SelectedMethodWgt(QtGui.QWidget):
self.ClientObj.signaling.wait()
return 1
if not self.user_changed_flag:
reply = QtGui.QMessageBox.Yes
reply = QtGuiWidgets.QMessageBox.Yes
else:
reply = self.show_close_messagebox()
from mainframe import MainFrame
if reply == QtGui.QMessageBox.Yes:
if reply == QtGuiWidgets.QMessageBox.Yes:
if hasattr (self, 'con_lost_lbl'):
self.con_lost_lbl.hide()
self.con_lost_lbl.close()
@ -188,31 +188,31 @@ class SelectedMethodWgt(QtGui.QWidget):
if self.ClientObj.process_dict[str(pid)]['status'] != '1':
return 1
time.sleep(1)
elif reply == QtGui.QMessageBox.No:
elif reply == QtGuiWidgets.QMessageBox.No:
return 0
def user_changed(self):
self.user_changed_flag = True
def show_close_messagebox(self):
msgBox = QtGui.QMessageBox(self)
msgBox = QtGuiWidgets.QMessageBox(self)
if self.ClientObj.method_names.has_key(self.method):
method_name = self.ClientObj.method_names[self.method]
else:
method_name = self.method
msgBox.setText(_("Close") +' "%s"?' %method_name)
msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
msgBox.setStandardButtons(QtGuiWidgets.QMessageBox.Yes | QtGuiWidgets.QMessageBox.No)
# translate
msgBox.button(msgBox.Yes).setText(_('Yes'))
msgBox.button(msgBox.No).setText(_('No'))
if QtGui.QIcon.hasThemeIcon('dialog-close'):
if QtGuiWidgets.QIcon.hasThemeIcon('dialog-close'):
msgBox.button(msgBox.No).setIcon \
(QtGui.QIcon.fromTheme('dialog-close'))
(QtGuiWidgets.QIcon.fromTheme('dialog-close'))
msgBox.setDefaultButton(QtGui.QMessageBox.No)
msgBox.setWindowIcon(QtGui.QIcon.fromTheme("application-exit"))
msgBox.setDefaultButton(QtGuiWidgets.QMessageBox.No)
msgBox.setWindowIcon(QtGuiWidgets.QIcon.fromTheme("application-exit"))
reply = msgBox.exec_()
return reply
@ -252,9 +252,9 @@ def parse():
return parser
class MyTabBar(QtGui.QTabBar):
class MyTabBar(QtGuiWidgets.QTabBar):
def __init__(self, _parent):
QtGui.QTabBar.__init__(self)
QtGuiWidgets.QTabBar.__init__(self)
self._parent = _parent
def wheelEvent(self, event):
@ -267,9 +267,9 @@ class MyTabBar(QtGui.QTabBar):
if event.button() == QtCore.Qt.MouseButton.MiddleButton:
self._parent.close_tab(self.tabAt(event.pos()))
class ToolTabWidget(QtGui.QTabWidget):
class ToolTabWidget(QtGuiWidgets.QTabWidget):
def __init__(self, app, args = None, host = None, port = None):
QtGui.QTabWidget.__init__(self)
QtGuiWidgets.QTabWidget.__init__(self)
self.app = app
if args:
if args.lang:
@ -286,17 +286,17 @@ class ToolTabWidget(QtGui.QTabWidget):
ClientObj = ApiClient(app, self)
self.FirstWidget = ClientObj.MainWidget
self.PlusWidget = QtGui.QWidget(self)
self.PlusWidget = QtGuiWidgets.QWidget(self)
self.tabbar = MyTabBar(self)
self.setTabBar(self.tabbar)
QtGui.QIcon.setThemeName('Calculate')
self.gui_icon = QtGui.QIcon.fromTheme("video-display")
QtGuiWidgets.QIcon.setThemeName('Calculate')
self.gui_icon = QtGuiWidgets.QIcon.fromTheme("video-display")
self.other_icon = QtGui.QIcon.fromTheme("list-add")
self.other_icon = QtGuiWidgets.QIcon.fromTheme("list-add")
if self.other_icon.isNull():
self.other_icon = QtGui.QIcon.fromTheme("preferences-desctop")
self.other_icon = QtGuiWidgets.QIcon.fromTheme("preferences-desctop")
self.addTab(self.FirstWidget, self.gui_icon , self.new_con_txt)
self.addTab(self.PlusWidget, self.other_icon, '')
@ -308,7 +308,7 @@ class ToolTabWidget(QtGui.QTabWidget):
self.currentChanged.connect(self.changeWindowTitle)
self.setTabsClosable(True)
self.tabbar.tabButton(1, QtGui.QTabBar.ButtonPosition.RightSide).hide()
self.tabbar.tabButton(1, QtGuiWidgets.QTabBar.ButtonPosition.RightSide).hide()
if not self.get_size():
# definition of screen resolution
@ -339,7 +339,7 @@ class ToolTabWidget(QtGui.QTabWidget):
stop: 0 #E9E9E9, stop: 0.4 #E5E5E5,
stop: 0.5 #E1E1E1, stop: 1.0 #DDDDDD);}
''')
self.setWindowIcon(QtGui.QIcon \
self.setWindowIcon(QtGuiWidgets.QIcon \
('/usr/share/pixmaps/calculate-console-offline.svg'))
self.show()
@ -382,12 +382,12 @@ class ToolTabWidget(QtGui.QTabWidget):
self.connect_dict.pop(host)
if self.connect_dict:
self.setWindowIcon(QtGui.QIcon \
self.setWindowIcon(QtGuiWidgets.QIcon \
('/usr/share/pixmaps/calculate-console-online.svg'))
if hasattr(self, 'tray'):
self.tray.set_icon(True)
else:
self.setWindowIcon(QtGui.QIcon \
self.setWindowIcon(QtGuiWidgets.QIcon \
('/usr/share/pixmaps/calculate-console-offline.svg'))
if hasattr(self, 'tray'):
self.tray.set_icon(False)
@ -496,7 +496,7 @@ class ToolTabWidget(QtGui.QTabWidget):
# self.connect_dict[ClientObj.host_name] = \
# [ClientObj, self.currentIndex()]
# self.tabbar.tabButton(self.currentIndex(), \
# QtGui.QTabBar.ButtonPosition.RightSide).hide()
# QtGuiWidgets.QTabBar.ButtonPosition.RightSide).hide()
def find_host(self, host_name, port):
ind = self.currentIndex()
@ -561,4 +561,4 @@ class ToolTabWidget(QtGui.QTabWidget):
if e.key() == QtCore.Qt.Key_Return:
self.currentWidget().keyPressEvent(e)
else:
QtGui.QTabWidget.keyPressEvent(self, e)
QtGuiWidgets.QTabWidget.keyPressEvent(self, e)

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import LabelWordWrap, _print, get_system_rgb, ParameterWindow
DEBUG_LEVEL = 0
@ -27,9 +27,9 @@ def debug(level, *args):
print
class MethodNameWgt(QtGui.QWidget):
class MethodNameWgt(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
self._parent = parent
self.ClientObj = ClientObj
@ -40,12 +40,12 @@ class MethodNameWgt(QtGui.QWidget):
"{background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
"stop: 0 #111111, stop: 0.95 #777777, stop: 1 #666666);}")
self.hlayout = QtGui.QHBoxLayout(self)
self.hlayout = QtGuiWidgets.QHBoxLayout(self)
self.hlayout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
self.hlayout.setContentsMargins(28, 0, 0, 0)
self.hlayout.setSpacing(0)
self.meth_name = QtGui.QLabel('Method Name', self)
self.meth_name = QtGuiWidgets.QLabel('Method Name', self)
# self.meth_name.setAlignment(QtCore.Qt.AlignLeft)
self.meth_name.setStyleSheet("font-size: 16px;"
"font: bold;"
@ -102,9 +102,9 @@ class MethodNameWgt(QtGui.QWidget):
# "stop: 0 #222222, stop: 1 #9797A0);}" + \
# self.button_hover_style + self.button_pressed_style)
class ControlButtonWgt(QtGui.QWidget):
class ControlButtonWgt(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
self._parent = parent
self.ClientObj = ClientObj
@ -115,18 +115,18 @@ class ControlButtonWgt(QtGui.QWidget):
"{background-color: %s;}"%
get_system_rgb(self, ParameterWindow))
self.main_layout = QtGui.QVBoxLayout(self)
self.main_layout = QtGuiWidgets.QVBoxLayout(self)
self.main_layout.setContentsMargins(28, 8, 0, 28)
self.question_label = LabelWordWrap("")
# self.question_label.hide()
self.main_layout.addWidget(self.question_label)
self.hlayout = QtGui.QHBoxLayout()
self.hlayout = QtGuiWidgets.QHBoxLayout()
self.hlayout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
self.hlayout.setContentsMargins(0, 0, 28, 0)
self.hlayout.setSpacing(0)
self.main_layout.addItem(QtGui.QSpacerItem(
0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
self.main_layout.addItem(QtGuiWidgets.QSpacerItem(
0, 0, QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding))
self.main_layout.addLayout(self.hlayout)
# self.setLayout(self.hlayout)
@ -182,12 +182,12 @@ class ControlButtonWgt(QtGui.QWidget):
next_button_text=None):
self.del_button()
buttons = self._parent.MainFrameWgt.buttons
self.button_widget = QtGui.QWidget(self)
end_layout = QtGui.QHBoxLayout(self.button_widget)
self.button_widget = QtGuiWidgets.QWidget(self)
end_layout = QtGuiWidgets.QHBoxLayout(self.button_widget)
end_layout.setContentsMargins(0, 0, 0, 0)
end_layout.setSpacing(10)
end_layout.addItem(QtGui.QSpacerItem(
0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum))
end_layout.addItem(QtGuiWidgets.QSpacerItem(
0, 0, QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Maximum))
self.customs = []
self.add_cancel_button(end_layout, Group, brief, next_button_text)
@ -198,7 +198,7 @@ class ControlButtonWgt(QtGui.QWidget):
self.add_next_button(end_layout, Group, brief, next_button_text)
has_next = True
else:
button = QtGui.QPushButton(self)
button = QtGuiWidgets.QPushButton(self)
self.customs.append(button)
button.setText(field.label.decode('utf-8'))
button.clicked.connect(self.button_disabled)
@ -209,8 +209,8 @@ class ControlButtonWgt(QtGui.QWidget):
button.setDisabled(True)
end_layout.addWidget(button)
if not has_next and button:
button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Enter))
button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Enter))
self.default_button = button
self.hlayout.addWidget(self.button_widget)
@ -220,12 +220,12 @@ class ControlButtonWgt(QtGui.QWidget):
self.del_button()
main_frame = self._parent.MainFrameWgt
# add 1 (or 2) button ok (next) [and previous]
self.button_widget = QtGui.QWidget(self)
end_layout = QtGui.QHBoxLayout(self.button_widget)
self.button_widget = QtGuiWidgets.QWidget(self)
end_layout = QtGuiWidgets.QHBoxLayout(self.button_widget)
end_layout.setContentsMargins(0, 0, 0, 0)
end_layout.setSpacing(10)
end_layout.addItem(QtGui.QSpacerItem(
0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum))
end_layout.addItem(QtGuiWidgets.QSpacerItem(
0, 0, QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Maximum))
self.add_cancel_button(end_layout, Group, brief, next_button_text)
self.add_prev_button(end_layout, Group, brief, next_button_text)
@ -239,7 +239,7 @@ class ControlButtonWgt(QtGui.QWidget):
next_button_text=None):
# создать кнопку отмена
main_frame = self._parent.MainFrameWgt
self.cancel_button = QtGui.QPushButton(self)
self.cancel_button = QtGuiWidgets.QPushButton(self)
if main_frame.has_errors:
self.cancel_button.setText(_('Close').decode('utf-8'))
else:
@ -258,13 +258,13 @@ class ControlButtonWgt(QtGui.QWidget):
if main_frame.has_errors:
self.cancel_button.setShortcut(
QtGui.QKeySequence(QtCore.Qt.Key_Return))
QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
self.cancel_button.setShortcut(
QtGui.QKeySequence(QtCore.Qt.Key_Enter))
QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Enter))
self.default_button = self.cancel_button
else:
self.cancel_button.setShortcut(
QtGui.QKeySequence(QtCore.Qt.Key_Escape))
QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
def add_prev_button(self, end_layout, Group, brief=False,
@ -274,7 +274,7 @@ class ControlButtonWgt(QtGui.QWidget):
if (self.ClientObj.param_objects[main_frame.method_name]['step'] != 0
and main_frame.mutable):
debug(10, "CREATE PREV BUTTON")
self.prev_button = QtGui.QPushButton(self)
self.prev_button = QtGuiWidgets.QPushButton(self)
self.prev_button.setText(Group.prevlabel or _('Previous'))
self.prev_button.clicked.connect(self.button_disabled)
@ -293,7 +293,7 @@ class ControlButtonWgt(QtGui.QWidget):
if (brief or main_frame.view.groups.GroupField[-1].last and
not main_frame.hasBrief()):
debug(10, "CREATE PERFORM BUTTON")
self.next_button = QtGui.QPushButton(self)
self.next_button = QtGuiWidgets.QPushButton(self)
if next_button_text and brief:
self.next_button.setText(next_button_text)
else:
@ -308,7 +308,7 @@ class ControlButtonWgt(QtGui.QWidget):
end_layout.addWidget(self.next_button)
else:
debug(10, "CREATE NEXT BUTTON")
self.next_button = QtGui.QPushButton(self)
self.next_button = QtGuiWidgets.QPushButton(self)
self.next_button.setText(Group.nextlabel or _("Next"))
self.next_button.clicked.connect(self.button_disabled)
@ -322,8 +322,8 @@ class ControlButtonWgt(QtGui.QWidget):
self.next_button.setMinimumWidth(64)
self.next_button.setFixedHeight(32)
self.next_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
self.next_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Enter))
self.next_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
self.next_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Enter))
self.default_button = self.next_button
def del_button(self):
@ -350,18 +350,18 @@ class ControlButtonWgt(QtGui.QWidget):
def pre_add_button(self):
self.del_button()
# add 1 (or 2) button ok (next) [and previous]
self.button_widget = QtGui.QWidget(self)
end_layout = QtGui.QHBoxLayout(self.button_widget)
self.button_widget = QtGuiWidgets.QWidget(self)
end_layout = QtGuiWidgets.QHBoxLayout(self.button_widget)
end_layout.setContentsMargins(0, 0, 0, 0)
end_layout.setSpacing(0)
end_layout.addItem(QtGui.QSpacerItem(0, 0, \
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Maximum))
end_layout.addItem(QtGuiWidgets.QSpacerItem(0, 0, \
QtGuiWidgets.QSizePolicy.Expanding,
QtGuiWidgets.QSizePolicy.Maximum))
return end_layout
def add_clear_cache_button(self, pid=None):
end_layout = self.pre_add_button()
self.clear_proc_cache_button = QtGui.QPushButton(_('Close'), self)
self.clear_proc_cache_button = QtGuiWidgets.QPushButton(_('Close'), self)
self.default_button = self.clear_proc_cache_button
self.ClientObj._parent.user_changed_flag = False
if pid:
@ -456,4 +456,4 @@ class ControlButtonWgt(QtGui.QWidget):
if self.cancel_button:
self.cancel_button.click()
else:
QtGui.QWidget.keyPressEvent(self, e)
QtGuiWidgets.QWidget.keyPressEvent(self, e)

@ -14,12 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import ButtonMenu, FlowLayout, get_sid, ClientServiceThread, \
get_view_params, show_msg, client_list_methods
class DisplayMethod(QtGui.QWidget):
class DisplayMethod(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
super(DisplayMethod, self).__init__(parent)
self.ClientObj = ClientObj
@ -34,18 +34,18 @@ class DisplayMethod(QtGui.QWidget):
IMAGE = 3 # Getting image path
self.lable_list = []
self.button_list = {}
self.layout = QtGui.QVBoxLayout()
self.layout = QtGuiWidgets.QVBoxLayout()
self.groupbox_dict = {}
self.layout_dict = {}
# set new Title
self.ClientObj._parent.setWindowTitle(self.ClientObj.Name)
background_color = self.palette().color(QtGui.QPalette.Base)
background_color = self.palette().color(QtGuiWidgets.QPalette.Base)
background_color = background_color.getRgb()
background_color = "rgb%s"%str(background_color[0:3])
#text_color = self.palette().color(QtGui.QPalette.Text)
#text_color = self.palette().color(QtGuiWidgets.QPalette.Text)
#text_color = text_color.getRgb()
#text_color = "rgb%s"%str(text_color[0:3])
text_color = "rgb(160,160,160)"
@ -103,7 +103,7 @@ class DisplayMethod(QtGui.QWidget):
sub_group = group.split('.')[1].encode('utf-8')
if not self.groupbox_dict.has_key(group_name):
self.groupbox_dict[group_name] = \
QtGui.QGroupBox(group_name.decode('utf-8'), self)
QtGuiWidgets.QGroupBox(group_name.decode('utf-8'), self)
self.groupbox_dict[group_name].setAlignment \
(QtCore.Qt.AlignLeft)
@ -139,7 +139,7 @@ class DisplayMethod(QtGui.QWidget):
if not self.groupbox_dict.has_key(group):
self.groupbox_dict[group] = \
QtGui.QGroupBox(group, self)
QtGuiWidgets.QGroupBox(group, self)
self.groupbox_dict[group].setAlignment(QtCore.Qt.AlignLeft)
if not self.layout_dict.has_key(group):
@ -287,15 +287,15 @@ class DisplayMethod(QtGui.QWidget):
self.ClientObj.MainWidget.delete_MainFrameWgt()
self.ClientObj.MainWidget.MainFrameWgt = \
QtGui.QWidget(self.ClientObj.MainWidget)
QtGuiWidgets.QWidget(self.ClientObj.MainWidget)
if not back:
# save data for a step back
self.ClientObj.back_step_list.append ([groups, sub_group, \
self.ClientObj._parent.windowTitle()])
hlayout = QtGui.QHBoxLayout()
hlayout.addItem(QtGui.QSpacerItem( 0, 0, \
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
hlayout = QtGuiWidgets.QHBoxLayout()
hlayout.addItem(QtGuiWidgets.QSpacerItem( 0, 0, \
QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding))
self.ClientObj.MainWidget.MainFrameWgt.setLayout(hlayout)
self.ClientObj.MainWidget.main_frame.setWidget \
@ -327,30 +327,30 @@ class DisplayMethod(QtGui.QWidget):
self.onActivated_thread.wait()
event.accept()
class StartWidget(QtGui.QWidget):
class StartWidget(QtGuiWidgets.QWidget):
def __init__(self, parent):
super(StartWidget, self).__init__(parent)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
class ConnectLostLabel (QtGui.QWidget):
class ConnectLostLabel (QtGuiWidgets.QWidget):
def __init__(self, text, parent, reconnect = False):
QtGui.QWidget.__init__(self, parent.layout_wgt)
QtGuiWidgets.QWidget.__init__(self, parent.layout_wgt)
self._parent = parent
if parent.main_frame.isEnabled():
parent.left_frame.setDisabled(True)
parent.main_frame.setDisabled(True)
parent.control_button.setDisabled(True)
white_layout = QtGui.QVBoxLayout(self)
lbl = QtGui.QLabel(text + '\n\n', self)
white_layout = QtGuiWidgets.QVBoxLayout(self)
lbl = QtGuiWidgets.QLabel(text + '\n\n', self)
white_layout.addWidget(lbl)
self.setStyleSheet ('background-color: rgba(250,250,250,200);'
'border-radius: 2px;')
if reconnect:
self.reconnect_button = QtGui.QPushButton(_('Reconnect'), self)
self.reconnect_button.setIcon(QtGui.QIcon.fromTheme('view-refresh'))
self.reconnect_button = QtGuiWidgets.QPushButton(_('Reconnect'), self)
self.reconnect_button.setIcon(QtGuiWidgets.QIcon.fromTheme('view-refresh'))
self.reconnect_button.setStyleSheet('''
QPushButton {
border: 2px solid #8f8f91;

@ -14,21 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import ButtonMenu, icon_visible, LabelWordWrap, get_sid, show_msg, \
ClientServiceThread, show_question, get_view_params, _print, \
get_system_rgb
class StepLabel(QtGui.QLabel):
class StepLabel(QtGuiWidgets.QLabel):
clicked = QtCore.Signal()
def __init__(self, text, parent):
QtGui.QLabel.__init__(self, parent)
QtGuiWidgets.QLabel.__init__(self, parent)
self.setWordWrap(True)
self.setText(text)
self.updateGeometry()
self.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
bg = get_system_rgb(parent._parent, QtGui.QPalette.Highlight)
bg = get_system_rgb(parent._parent, QtGuiWidgets.QPalette.Highlight)
self.setStyleSheet("QLabel {margin-left: 0px; margin-right: 0px;}"
"QLabel:hover {"#color: blue;"
# "QLabel:hover {color: white;"
@ -45,9 +45,9 @@ class StepLabel(QtGui.QLabel):
font.setBold(bold)
self.setFont(font)
class LeftMenu(QtGui.QScrollArea):
class LeftMenu(QtGuiWidgets.QScrollArea):
def __init__(self, parent, ClientObj):
QtGui.QScrollArea.__init__(self, parent)
QtGuiWidgets.QScrollArea.__init__(self, parent)
self._parent = parent
self.ClientObj = ClientObj
@ -80,7 +80,7 @@ class LeftMenu(QtGui.QScrollArea):
# "border-bottom: 0px;"
# "border-left: 0px;"
# "border-top: 0px;}")
self.setFrameShape(QtGui.QFrame.Shape.NoFrame)
self.setFrameShape(QtGuiWidgets.QFrame.Shape.NoFrame)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
def create_menu(self, display_wgt, groups, sub_groups, ClientObj):
@ -90,7 +90,7 @@ class LeftMenu(QtGui.QScrollArea):
# icon_visible(self._parent.ClientObj.MainWidget, 'Methods', True)
icon_visible(self._parent.ClientObj.MainWidget, 'Back', True)
self.widget = QtGui.QWidget (self)
self.widget = QtGuiWidgets.QWidget (self)
#self.cur_palette = display_wgt._parent.viewport().palette()
#self.widget.setPalette(self.cur_palette)
@ -100,7 +100,7 @@ class LeftMenu(QtGui.QScrollArea):
self.lable_list = []
self.button_list = {}
self.layout = QtGui.QVBoxLayout(self.widget)
self.layout = QtGuiWidgets.QVBoxLayout(self.widget)
self.layout.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignHCenter)
@ -180,12 +180,12 @@ class LeftMenu(QtGui.QScrollArea):
def groupActivated(self, groups, sub_group, title, ClientObj, back = False):
ClientObj.MainWidget.delete_MainFrameWgt()
ClientObj.MainWidget.MainFrameWgt = QtGui.QWidget \
ClientObj.MainWidget.MainFrameWgt = QtGuiWidgets.QWidget \
(ClientObj.MainWidget)
hlayout = QtGui.QHBoxLayout()
hlayout.addItem(QtGui.QSpacerItem( 0, 0, \
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding ))
hlayout = QtGuiWidgets.QHBoxLayout()
hlayout.addItem(QtGuiWidgets.QSpacerItem( 0, 0, \
QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding ))
ClientObj.MainWidget.MainFrameWgt.setLayout(hlayout)
@ -260,7 +260,7 @@ class LeftMenu(QtGui.QScrollArea):
# icon_visible(self._parent.ClientObj.MainWidget, 'Methods', True)
icon_visible(self._parent.ClientObj.MainWidget, 'Back', True)
self.widget = QtGui.QWidget (self)
self.widget = QtGuiWidgets.QWidget (self)
#--self.widget.setPalette(self.cur_palette)
# self.widget.setStyleSheet("QWidget { background-color: rgb (%s) }" \
@ -270,18 +270,18 @@ class LeftMenu(QtGui.QScrollArea):
self.widget.setObjectName('QQQ')
self.widget.setStyleSheet("QWidget#QQQ { "
"background-color: %s;}"
% get_system_rgb(self, QtGui.QPalette.Base))
% get_system_rgb(self, QtGuiWidgets.QPalette.Base))
#self.setStyleSheet("QScrollArea { "
# "background-color: qlineargradient("
# "x1: 0, y1: 0, x2: 0, y2: 1, "
# "stop: 0 %(start)s, stop: 0.7 %(start)s, "
# "stop: 0.9 %(end)s, stop: 1 %(end)s);}"%
# {'start':get_system_rgb(self, QtGui.QPalette.Base),
# 'end':get_system_rgb(self, QtGui.QPalette.Window),
# {'start':get_system_rgb(self, QtGuiWidgets.QPalette.Base),
# 'end':get_system_rgb(self, QtGuiWidgets.QPalette.Window),
# })
self.button_list = []
self.layout = QtGui.QVBoxLayout(self.widget)
self.layout = QtGuiWidgets.QVBoxLayout(self.widget)
self.layout.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignHCenter)
# self.layout.setContentsMargins(28,28,28,0)
self.layout.setContentsMargins(2,28,2,0)
@ -295,8 +295,8 @@ class LeftMenu(QtGui.QScrollArea):
self.button_list.append(StepLabel(steps[num_step], self))
# if len(icons) > num_step:
# themeName = QtGui.QIcon.themeName()
# icon = QtGui.QIcon()
# themeName = QtGuiWidgets.QIcon.themeName()
# icon = QtGuiWidgets.QIcon()
# icon.setThemeName(themeName)
# icon = icon.fromTheme(icons[num_step])
# if icon.isNull():
@ -314,9 +314,9 @@ class LeftMenu(QtGui.QScrollArea):
# (self.check_step(method_name, num_step))
# calculate button width
fmn = QtGui.QFontMetrics(QtGui.QFont('',-1,QtGui.QFont.Normal))
fmn = QtGuiWidgets.QFontMetrics(QtGuiWidgets.QFont('',-1,QtGuiWidgets.QFont.Normal))
normal_width = fmn.width(self.button_list[num_step].text())
fmb = QtGui.QFontMetrics(QtGui.QFont('',-1,QtGui.QFont.Bold))
fmb = QtGuiWidgets.QFontMetrics(QtGuiWidgets.QFont('',-1,QtGuiWidgets.QFont.Bold))
bold_width = fmb.width(self.button_list[num_step].text())
diff = bold_width - normal_width + 6
@ -340,8 +340,8 @@ class LeftMenu(QtGui.QScrollArea):
self.changed_step(self._parent.ClientObj.param_objects \
[method_name]['step'])
# self.layout.addItem(QtGui.QSpacerItem(100, 100, \
# QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
# self.layout.addItem(QtGuiWidgets.QSpacerItem(100, 100, \
# QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding))
self.setWidget(self.widget)
@ -452,7 +452,7 @@ class LeftMenu(QtGui.QScrollArea):
reply = show_question(self._parent, text, informative_text, \
not_move = True, title = _('Calculate Console'))
if reply == QtGui.QMessageBox.No:
if reply == QtGuiWidgets.QMessageBox.No:
self.setEnabled(True)
return

@ -15,13 +15,13 @@
# limitations under the License.
from Box import MainWgt
from PySide import QtGui
from calculate.consolegui.qtwrapper import QtGuiWidgets
#from mainmenu import MainMenu
import os
import ConfigParser
class ApiClient(QtGui.QWidget):
class ApiClient(QtGuiWidgets.QWidget):
def __init__(self, app, tabs):
super(ApiClient, self).__init__()
self.app = app
@ -50,7 +50,7 @@ class ApiClient(QtGui.QWidget):
self.client = None
self.host_name = None
self.res_layout = QtGui.QVBoxLayout(self)
self.res_layout = QtGuiWidgets.QVBoxLayout(self)
self.process_dict = {}
self.param_objects = {}

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
DEBUG_LEVEL = 0
@ -44,11 +44,11 @@ class LabelWordWrap(Label):
self.setTextInteractionFlags(self.textInteractionFlags() | \
QtCore.Qt.TextSelectableByMouse)
class PlusButton(QtGui.QPushButton):
class PlusButton(QtGuiWidgets.QPushButton):
def __init__(self, parent, ClientObj, method, disable_method=None):
QtGui.QPushButton.__init__(self, parent)
QtGuiWidgets.QPushButton.__init__(self, parent)
try:
self.setIcon(QtGui.QIcon.fromTheme('list-add'))
self.setIcon(QtGuiWidgets.QIcon.fromTheme('list-add'))
except:
self.setText('+')
self._parent = parent
@ -81,12 +81,12 @@ class PlusButton(QtGui.QPushButton):
' - ' + self.ClientObj.Name)
self._parent._parent.main_frame_view(view, self.method)
class MainFrameRes(QtGui.QWidget):
class MainFrameRes(QtGuiWidgets.QWidget):
valSignal = QtCore.Signal()
def __init__(self, parent, ClientObj, method_name, meth_result,
change_offset=False):
# super(MainFrameRes, self).__init__(self, parent)
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
self._parent = parent
self.ClientObj = ClientObj
self.method_name = method_name
@ -132,7 +132,7 @@ class MainFrameRes(QtGui.QWidget):
def initUI(self):
#self.setSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Minimum)
#self.setSizePolicy(QtGuiWidgets.QSizePolicy.Minimum,QtGuiWidgets.QSizePolicy.Minimum)
self.updateGeometry()
def show_bottom(self):
@ -201,22 +201,22 @@ class MainFrameRes(QtGui.QWidget):
self.mytable.setHorizontalHeaderLabels(list_head)
for line in range(len(table.body[0])):
for i in range(len(table.body[0][line][0])):
tablewidgetitem = QtGui.QTableWidgetItem(
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(
table.body[0][line][0][i])
#tablewidgetitem.setTextAlignment(
# QtCore.Qt.Align | QtCore.Qt.AlignLeft)
self.mytable.setItem(line, i, tablewidgetitem)
# set writeonly
self.mytable.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.mytable.setEditTriggers(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
if table.onClick:
self.mytable.itemClicked.connect(self.row_activate(table))
self.mytable.setColor()
minimum = QtGui.QSizePolicy.Minimum
minimum = QtGuiWidgets.QSizePolicy.Minimum
self.mytable.setSizePolicy(minimum, minimum)
self.mytable.horizontalHeader().resizeSections(
QtGui.QHeaderView.ResizeMode.ResizeToContents)
QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
self.work_layout._addWidget(self.mytable)
self.ClientObj.app.processEvents()
self.mytable.resizeRowsToContents()
@ -278,8 +278,8 @@ class MainFrameRes(QtGui.QWidget):
self.timer.stop()
def add_offset_buttons(self, len_body, addAction, records):
offset_buttons = QtGui.QWidget()
layout = QtGui.QHBoxLayout(offset_buttons)
offset_buttons = QtGuiWidgets.QWidget()
layout = QtGuiWidgets.QHBoxLayout(offset_buttons)
layout.setAlignment(QtCore.Qt.AlignLeft)
offset = self.ClientObj.param_objects[self.method_name]['offset']
@ -298,8 +298,8 @@ class MainFrameRes(QtGui.QWidget):
last = False
begin_offset = QtGui.QPushButton(offset_buttons)
begin_offset.setIcon(QtGui.QIcon.fromTheme('go-first'))
begin_offset = QtGuiWidgets.QPushButton(offset_buttons)
begin_offset.setIcon(QtGuiWidgets.QIcon.fromTheme('go-first'))
begin_offset.setToolTip('First page')
begin_offset.clicked.connect(self.disable_buttons)
begin_offset.clicked.connect(self.call_method_with_offset(0, True))
@ -308,8 +308,8 @@ class MainFrameRes(QtGui.QWidget):
layout.addWidget(begin_offset)
minus_offset = QtGui.QPushButton(offset_buttons)
minus_offset.setIcon(QtGui.QIcon.fromTheme('go-previous'))
minus_offset = QtGuiWidgets.QPushButton(offset_buttons)
minus_offset.setIcon(QtGuiWidgets.QIcon.fromTheme('go-previous'))
minus_offset.setToolTip('Previous page')
minus_offset.clicked.connect(self.disable_buttons)
minus_offset.clicked.connect(self.call_method_with_offset(
@ -323,8 +323,8 @@ class MainFrameRes(QtGui.QWidget):
begin_offset.setDisabled(True)
plus_offset = QtGui.QPushButton(offset_buttons)
plus_offset.setIcon(QtGui.QIcon.fromTheme('go-next'))
plus_offset = QtGuiWidgets.QPushButton(offset_buttons)
plus_offset.setIcon(QtGuiWidgets.QIcon.fromTheme('go-next'))
plus_offset.setToolTip('Next page')
plus_offset.clicked.connect(self.disable_buttons)
plus_offset.clicked.connect(self.call_method_with_offset(
@ -333,8 +333,8 @@ class MainFrameRes(QtGui.QWidget):
layout.addWidget(plus_offset)
self.buttons.append(plus_offset)
last_offset = QtGui.QPushButton(offset_buttons)
last_offset.setIcon(QtGui.QIcon.fromTheme('go-last'))
last_offset = QtGuiWidgets.QPushButton(offset_buttons)
last_offset.setIcon(QtGuiWidgets.QIcon.fromTheme('go-last'))
last_offset.setToolTip('Last page')
last_offset.clicked.connect(self.disable_buttons)
last_offset.clicked.connect(self.call_method_with_offset(
@ -837,7 +837,7 @@ class MainFrameRes(QtGui.QWidget):
self.get_Frame(sid, pid, def_end_frame = end_frame)
def add_Progress(self):
progressBar = QtGui.QProgressBar()
progressBar = QtGuiWidgets.QProgressBar()
progressBar.setMinimumHeight(progressBar.sizeHint().height())
progressBar.setTextVisible(True)
self.progress_list.append(progressBar)
@ -1027,7 +1027,7 @@ class MainFrameRes(QtGui.QWidget):
event.accept()
class MessageDialog(QtGui.QWidget):
class MessageDialog(QtGuiWidgets.QWidget):
# answer to the server question
def __init__(self, parent, item, sid, pid, isPassword = False):
super(MessageDialog, self).__init__()
@ -1036,11 +1036,11 @@ class MessageDialog(QtGui.QWidget):
self.sid = sid
self.pid = pid
self.setWindowTitle(self._parent.ClientObj._parent.windowTitle())
self.layout = QtGui.QGridLayout(self)
self.layout = QtGuiWidgets.QGridLayout(self)
self.label = LabelWordWrap(item.message, self)
self.pass_edit = QtGui.QLineEdit(self)
self.pass_edit = QtGuiWidgets.QLineEdit(self)
self.layout.addWidget(self.label,0,0)
self.layout.addWidget(self.pass_edit,0,1)
@ -1049,7 +1049,7 @@ class MessageDialog(QtGui.QWidget):
self.pass_edit.setEchoMode(self.pass_edit.Password)
if item.id == 2:
if hasattr(self,'pass_edit2'):
self.pass_edit2 = QtGui.QLineEdit(self)
self.pass_edit2 = QtGuiWidgets.QLineEdit(self)
self.pass_edit2.setEchoMode(self.pass_edit2.Password)
self.layout.addWidget(LabelWordWrap(_('Repeat'), self), x, 0)
@ -1059,8 +1059,8 @@ class MessageDialog(QtGui.QWidget):
if hasattr(self,'pass_edit2'):
self.pass_edit2.textChanged.connect(self.check_passwd)
self.send_button = QtGui.QPushButton(_('Send'), self)
self.send_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
self.send_button = QtGuiWidgets.QPushButton(_('Send'), self)
self.send_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
self.send_button.clicked.connect(self.send_password)
self.layout.addWidget(self.send_button,x,1)
@ -1106,7 +1106,7 @@ class MessageDialog(QtGui.QWidget):
self.send_button.setEnabled(True)
class ButtonDialog(QtGui.QWidget):
class ButtonDialog(QtGuiWidgets.QWidget):
button_size = 144
def __init__(self, parent, item, sid, pid):
@ -1114,11 +1114,11 @@ class ButtonDialog(QtGui.QWidget):
self._parent = parent
self.sid = sid
self.pid = pid
self.layout = QtGui.QHBoxLayout(self)
self.layout = QtGuiWidgets.QHBoxLayout(self)
self.layout.setContentsMargins(0, 0, 4, 0)
self.header_label = None
minimum = QtGui.QSizePolicy.Fixed
minimum = QtGuiWidgets.QSizePolicy.Fixed
self.setSizePolicy(minimum, minimum)
self.init(item)
@ -1129,15 +1129,15 @@ class ButtonDialog(QtGui.QWidget):
"""
Создать кнопку в диалоге
"""
button = QtGui.QPushButton(label, self)
button = QtGuiWidgets.QPushButton(label, self)
if type(shortcut) in (list, tuple):
action = QtGui.QAction(self)
action.setShortcuts(map(QtGui.QKeySequence,
action = QtGuiWidgets.QAction(self)
action.setShortcuts(map(QtGuiWidgets.QKeySequence,
shortcut))
action.triggered.connect(button.animateClick)
button.addAction(action)
elif shortcut:
button.setShortcut(QtGui.QKeySequence(shortcut))
button.setShortcut(QtGuiWidgets.QKeySequence(shortcut))
button.clicked.connect(self.send(answer, label))
button.setFixedWidth(self.button_size)
button.setFixedHeight(32)

@ -14,29 +14,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import get_system_rgb, ParameterWindow
class Delegate(QtGui.QStyledItemDelegate):
class Delegate(QtGuiWidgets.QStyledItemDelegate):
def __init__(self, parent = None):
QtGui.QStyledItemDelegate.__init__(self, parent)
QtGuiWidgets.QStyledItemDelegate.__init__(self, parent)
def setView(self, view):
self.view = view
def paint(self, painter, option, index):
o = QtGui.QStyleOptionViewItemV4(option)
o = QtGuiWidgets.QStyleOptionViewItemV4(option)
self.initStyleOption(o, index)
if o.state & QtGui.QStyle.State_MouseOver:
if o.state & QtGuiWidgets.QStyle.State_MouseOver:
self.view.setMouseOver(index.row())
o.state &= ~QtGui.QStyle.State_MouseOver
QtGui.QStyledItemDelegate.paint(self, painter, o, index)
o.state &= ~QtGuiWidgets.QStyle.State_MouseOver
QtGuiWidgets.QStyledItemDelegate.paint(self, painter, o, index)
class SelectedTableWidget(QtGui.QTableWidget):
class SelectedTableWidget(QtGuiWidgets.QTableWidget):
def __init__(self, rows, columns, parent, readonly = False, brief = False):
QtGui.QTableWidget.__init__(self, rows, columns, parent)
QtGuiWidgets.QTableWidget.__init__(self, rows, columns, parent)
self.currHovered = -1
self.brief = brief
self.bFixedHeight = True
@ -47,11 +47,11 @@ class SelectedTableWidget(QtGui.QTableWidget):
self.setMouseTracking(True)
self.readonly = readonly
self.setSelectionMode(QtGui.QAbstractItemView.SelectionMode.NoSelection)
self.setSelectionMode(QtGuiWidgets.QAbstractItemView.SelectionMode.NoSelection)
self.horizontalHeader().moveSection(-1,0)
self.horizontalHeader().setFixedHeight(24)
self.horizontalHeader().setMinimumSectionSize(48)
self.setFrameStyle(QtGui.QFrame.NoFrame)
self.setFrameStyle(QtGuiWidgets.QFrame.NoFrame)
self.verticalHeader().hide()
item_background = 'transparent' if brief else get_system_rgb(
@ -78,7 +78,7 @@ class SelectedTableWidget(QtGui.QTableWidget):
item = self.item(row, col)
if not item:
continue
brush = QtGui.QBrush(
brush = QtGuiWidgets.QBrush(
self.palette().color(ParameterWindow))
item.setBackground(brush)
@ -89,7 +89,7 @@ class SelectedTableWidget(QtGui.QTableWidget):
if event.button() != QtCore.Qt.MouseButton.LeftButton:
event.ignore()
else:
QtGui.QTableWidget.mousePressEvent(self, event)
QtGuiWidgets.QTableWidget.mousePressEvent(self, event)
event.accept()
def setMouseOver(self, row):
@ -99,9 +99,9 @@ class SelectedTableWidget(QtGui.QTableWidget):
item = self.item(row, col)
if not item:
continue
bg = self.palette().color(QtGui.QPalette.Highlight)
item.setBackground(QtGui.QBrush(bg))
#QtGui.QColor(220,220,220,255)))
bg = self.palette().color(QtGuiWidgets.QPalette.Highlight)
item.setBackground(QtGuiWidgets.QBrush(bg))
#QtGuiWidgets.QColor(220,220,220,255)))
if self.currHovered != -1:
self.disableMouseOver()
@ -117,11 +117,11 @@ class SelectedTableWidget(QtGui.QTableWidget):
if not item:
continue
bg = self.palette().color(ParameterWindow)
item.setBackground(QtGui.QBrush(bg))
#item.setBackground(QtGui.QBrush(QtGui.QColor("white")))
item.setBackground(QtGuiWidgets.QBrush(bg))
#item.setBackground(QtGuiWidgets.QBrush(QtGuiWidgets.QColor("white")))
def mouseMoveEvent(self, event):
QtGui.QTableView.mouseMoveEvent(self, event)
QtGuiWidgets.QTableView.mouseMoveEvent(self, event)
def leaveEvent(self, event):
if self.readonly:

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
import time, urllib2
from calculate.core.client.function import create_obj
@ -88,7 +88,7 @@ class TrayUpdateSystem(QtCore.QThread):
self._parent.localhost_ClientObj.process_dict \
[meth_result[0].message]['name'] = method_name
self._parent.localhost_ClientObj.process_dict \
[meth_result[0].message]['layout'] = QtGui.QVBoxLayout()
[meth_result[0].message]['layout'] = QtGuiWidgets.QVBoxLayout()
self._parent.localhost_ClientObj.process_dict \
[meth_result[0].message]['layout'].setAlignment \
(QtCore.Qt.AlignTop)
@ -147,7 +147,7 @@ class TrayUpdateSystem(QtCore.QThread):
self.close_flag = True
class TrayIcon(QtGui.QSystemTrayIcon):
class TrayIcon(QtGuiWidgets.QSystemTrayIcon):
default_theme_name = 'Tango'
def __init__(self, parent):
@ -155,7 +155,7 @@ class TrayIcon(QtGui.QSystemTrayIcon):
self._parent = parent
self.actions = []
self.setIcon(QtGui.QIcon(
self.setIcon(QtGuiWidgets.QIcon(
'/usr/share/pixmaps/calculate-console-offline.svg'))
self.is_online_icon = False
@ -176,16 +176,16 @@ class TrayIcon(QtGui.QSystemTrayIcon):
self.update_thread.started_sig.connect(self.showUpdate)
def select_icon(self, icons):
old_theme_name = QtGui.QIcon.themeName()
old_theme_name = QtGuiWidgets.QIcon.themeName()
try:
for theme_name in (old_theme_name, self.default_theme_name):
QtGui.QIcon.setThemeName(theme_name)
QtGuiWidgets.QIcon.setThemeName(theme_name)
for image in icons:
if QtGui.QIcon.hasThemeIcon(image):
return QtGui.QIcon.fromTheme(image)
return QtGui.QIcon()
if QtGuiWidgets.QIcon.hasThemeIcon(image):
return QtGuiWidgets.QIcon.fromTheme(image)
return QtGuiWidgets.QIcon()
finally:
QtGui.QIcon.setThemeName(old_theme_name)
QtGuiWidgets.QIcon.setThemeName(old_theme_name)
def generation_actions(self):
_("About")
@ -222,12 +222,12 @@ class TrayIcon(QtGui.QSystemTrayIcon):
}
for action_name, action_data in self.actions.items():
setattr(self, '%s_action' % action_name,
QtGui.QAction(self.select_icon(action_data['icons']),
QtGuiWidgets.QAction(self.select_icon(action_data['icons']),
_(action_data['label']), self,
triggered=action_data['trigger']))
def create_menu(self, *actions):
menu = QtGui.QMenu()
menu = QtGuiWidgets.QMenu()
for action in actions:
if action:
menu.addAction(getattr(self, "%s_action" % action))
@ -255,7 +255,7 @@ class TrayIcon(QtGui.QSystemTrayIcon):
if online:
if not self.is_online_icon:
self.setIcon(QtGui.QIcon(
self.setIcon(QtGuiWidgets.QIcon(
'/usr/share/pixmaps/calculate-console-online.svg'))
# для решения странного размера иконки в mate
self.hide()
@ -263,7 +263,7 @@ class TrayIcon(QtGui.QSystemTrayIcon):
self.is_online_icon = True
else:
if self.is_online_icon:
self.setIcon(QtGui.QIcon(
self.setIcon(QtGuiWidgets.QIcon(
'/usr/share/pixmaps/calculate-console-offline.svg'))
# для решения странного размера иконки в mate
self.hide()
@ -330,18 +330,18 @@ class TrayIcon(QtGui.QSystemTrayIcon):
# informative_text = _('Stop updating and exit?')
# reply = show_question(self._parent, text, informative_text)
# if reply == QtGui.QMessageBox.No:
# if reply == QtGuiWidgets.QMessageBox.No:
# return 0
# elif reply == QtGui.QMessageBox.Yes:
# elif reply == QtGuiWidgets.QMessageBox.Yes:
# self.update_thread.close()
# self.update_thread.wait()
self._parent._closeEvent()
def activ(self, reason):
if reason == QtGui.QSystemTrayIcon.Trigger:
if reason == QtGuiWidgets.QSystemTrayIcon.Trigger:
self.windowVisible()
if reason == QtGui.QSystemTrayIcon.DoubleClick:
if reason == QtGuiWidgets.QSystemTrayIcon.DoubleClick:
self.windowVisible()
def showMessage(self, title, message, icon='dialog-warning'):

@ -14,16 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from pid_information import client_list_pid, client_pid_info
from more import LabelWordWrap, show_msg, get_sid, ClientServiceThread
class ViewProc(QtGui.QWidget):
class ViewProc(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
# super(ViewProc, self).__init__(parent)
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
# self._parent = parent
self.ClientObj = ClientObj
self.client = ClientObj.client
@ -38,7 +38,7 @@ class ViewProc(QtGui.QWidget):
self.lable_list = []
self.button_list = []
self.status_list = []
self.grid_layout = QtGui.QGridLayout()
self.grid_layout = QtGuiWidgets.QGridLayout()
self.helpLabel = LabelWordWrap \
(_('View information about the running processes'), self)
self.grid_layout.addWidget(self.helpLabel, 0, 0, 1, 0)
@ -84,7 +84,7 @@ class ViewProc(QtGui.QWidget):
# add status button
if self.ClientObj.process_dict[str(list_pid[num])]['status'] == '1':
kill_but_text = _('Kill the process? (It\'s active)')
kill_button = QtGui.QPushButton(kill_but_text, self)
kill_button = QtGuiWidgets.QPushButton(kill_but_text, self)
kill_button.clicked.connect(self.kill_process \
(int(list_pid[num]), num+2, 2))
self.status_list.append(kill_button)
@ -101,7 +101,7 @@ class ViewProc(QtGui.QWidget):
# add 'View result' button
button_text = _('View the result, PID %s') %str(list_pid[num])
Button = QtGui.QPushButton(button_text, self)
Button = QtGuiWidgets.QPushButton(button_text, self)
Button.clicked.connect(self.onActivated(str(list_pid[num]), \
str(view_method_name)))

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
import urllib2 as u2
if hasattr(u2,"ssl"):
u2.ssl._create_default_https_context = u2.ssl._create_unverified_context
@ -39,14 +39,14 @@ from more import show_msg, show_question, LabelWordWrap
flag = 0
log = getLogger(__name__)
class AddServerCert (QtGui.QDialog):
class AddServerCert (QtGuiWidgets.QDialog):
def __init__(self, parent, ClientObj, cert):
super(AddServerCert, self).__init__()
self.ClientObj = ClientObj
self.parent = parent
self.cert = cert
self.grid = QtGui.QGridLayout(self)
self.grid = QtGuiWidgets.QGridLayout(self)
self.lbl_list = []
self.grid.addWidget(LabelWordWrap(_('Untrusted Server Certificate!'), \
@ -59,10 +59,10 @@ class AddServerCert (QtGui.QDialog):
self.grid.addWidget(LabelWordWrap (_('Serial Number = %s') \
% certobj.get_serial_number(), self), 2, 0, 1, 3)
self.tab = QtGui.QTabWidget(self)
self.tab = QtGuiWidgets.QTabWidget(self)
# add Issuer tab
self.issuer_wgt = QtGui.QWidget(self)
self.issuer_layout = QtGui.QVBoxLayout()
self.issuer_wgt = QtGuiWidgets.QWidget(self)
self.issuer_layout = QtGuiWidgets.QVBoxLayout()
Issuer = certobj.get_issuer().get_components()
for i in Issuer:
@ -73,8 +73,8 @@ class AddServerCert (QtGui.QDialog):
self.tab.addTab(self.issuer_wgt, _('Issuer'))
# add Subject tab
self.subject_wgt = QtGui.QWidget(self)
self.subject_layout = QtGui.QVBoxLayout()
self.subject_wgt = QtGuiWidgets.QWidget(self)
self.subject_layout = QtGuiWidgets.QVBoxLayout()
Subject = certobj.get_subject().get_components()
for item in Subject:
@ -94,8 +94,8 @@ class AddServerCert (QtGui.QDialog):
(_("Add this server certificate to trusted or ") +\
_('try adding the CA and root certificates to trusted?'),self))
self.pix_lbl = QtGui.QLabel(self)
pi = QtGui.QPixmap()
self.pix_lbl = QtGuiWidgets.QLabel(self)
pi = QtGuiWidgets.QPixmap()
pi.load('/usr/share/icons/oxygen/48x48/status/security-medium.png')
self.pix_lbl.setPixmap(pi)
self.grid.addWidget(self.pix_lbl, 0,0)
@ -104,20 +104,20 @@ class AddServerCert (QtGui.QDialog):
self.grid.addWidget(self.lbl_list[num_lbl], num_lbl + 8, 0, 1, 3)
x = len (self.lbl_list) + 8
self.server_but = QtGui.QPushButton(_('Add the server certificate'),
self.server_but = QtGuiWidgets.QPushButton(_('Add the server certificate'),
self)
self.server_but.clicked.connect(self.add_server)
self.server_but.clicked.connect(self.close)
self.grid.addWidget(self.server_but, x, 0)
self.ca_but = QtGui.QPushButton(_("Add the CA and root certificates"),
self.ca_but = QtGuiWidgets.QPushButton(_("Add the CA and root certificates"),
self)
self.ca_but.clicked.connect(self.add_ca)
self.ca_but.clicked.connect(self.add_server)
self.ca_but.clicked.connect(self.close)
self.grid.addWidget(self.ca_but, x, 1)
self.cancel_but = QtGui.QPushButton(_('Cancel'), self)
self.cancel_but = QtGuiWidgets.QPushButton(_('Cancel'), self)
self.cancel_but.clicked.connect(self.close)
self.grid.addWidget(self.cancel_but, x, 2)
@ -436,10 +436,10 @@ class CheckingClientHTTPSConnection(CheckingHTTPSConnection):
reply = show_question(self.ClientObj.MainWidget, text, inf_text,
title = _('Adding the certificate'))
if reply == QtGui.QMessageBox.No:
if reply == QtGuiWidgets.QMessageBox.No:
show_msg (_('Certificate not added to trusted'))
elif reply == QtGui.QMessageBox.Yes:
elif reply == QtGuiWidgets.QMessageBox.Yes:
list_ca_certs.append(cert)
self.add_all_ca_cert(list_ca_certs)
return

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from sudsds import WebFault
import logging, OpenSSL
import ConfigParser, os, urllib2
@ -27,28 +27,28 @@ from calculate.core.client.cert_verify import VerifyError
from client_class import Client_suds, HTTPSClientCertTransport
from more import post_connect_action, show_msg, uniq, LabelWordWrap
class LocalhostPasswd(QtGui.QDialog):
class LocalhostPasswd(QtGuiWidgets.QDialog):
def __init__(self, parent):
QtGui.QDialog.__init__(self)
grid = QtGui.QGridLayout(self)
QtGuiWidgets.QDialog.__init__(self)
grid = QtGuiWidgets.QGridLayout(self)
grid.setContentsMargins(10, 10, 10, 10)
grid.setSpacing(4)
self.lbl_passwd = QtGui.QLabel(_("Password"), self)
self.text_passwd = QtGui.QLineEdit('', self)
self.lbl_passwd = QtGuiWidgets.QLabel(_("Password"), self)
self.text_passwd = QtGuiWidgets.QLineEdit('', self)
self.text_passwd.setEchoMode(self.text_passwd.Password)
grid.addWidget(self.lbl_passwd, 0, 0)
grid.addWidget(self.text_passwd, 0, 1)
layout_button = QtGui.QHBoxLayout()
self.cmd_ok = QtGui.QPushButton(_('Ok'), self)
layout_button = QtGuiWidgets.QHBoxLayout()
self.cmd_ok = QtGuiWidgets.QPushButton(_('Ok'), self)
self.cmd_ok.setDefault(True)
self.cmd_ok.setAutoDefault(True)
self.cmd_ok.clicked.connect(self.set_disabled)
self.cmd_ok.clicked.connect(self.onClick)
self.cmd_ok.setFixedWidth(100)
self.cmd_cancel = QtGui.QPushButton(_('Cancel'), self)
self.cmd_cancel.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
self.cmd_cancel = QtGuiWidgets.QPushButton(_('Cancel'), self)
self.cmd_cancel.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
self.cmd_cancel.clicked.connect(self.close)
self.cmd_cancel.setFixedWidth(100)
layout_button.addWidget(self.cmd_ok)
@ -70,22 +70,22 @@ class LocalhostPasswd(QtGui.QDialog):
def text(self):
return self._text
class FrameConnection(QtGui.QWidget):
class FrameConnection(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
QtGui.QWidget.__init__(self)
QtGuiWidgets.QWidget.__init__(self)
self.ClientObj = ClientObj
def initUI(self, parent, window):
grid = QtGui.QGridLayout(self)
grid = QtGuiWidgets.QGridLayout(self)
grid.setContentsMargins(10, 10, 10, 10)
grid.setSpacing(4)
self.lbl_host = LabelWordWrap(_("Host"), self)
self.lbl_port = LabelWordWrap(_("Port"), self)
self.lbl_passwd = LabelWordWrap(_("Password"), self)
self.text_host = QtGui.QLineEdit(self.ClientObj.default_host, self)
self.text_port = QtGui.QLineEdit(self.ClientObj.default_port, self)
self.text_passwd = QtGui.QLineEdit('', self)
self.text_host = QtGuiWidgets.QLineEdit(self.ClientObj.default_host, self)
self.text_port = QtGuiWidgets.QLineEdit(self.ClientObj.default_port, self)
self.text_passwd = QtGuiWidgets.QLineEdit('', self)
self.text_passwd.setEchoMode(self.text_passwd.Password)
######################
# add completer in 'host name' QLineEdit
@ -94,7 +94,7 @@ class FrameConnection(QtGui.QWidget):
self.wordList.append (self.text_host.text())
self.wordList = uniq(self.wordList)
del (self.completer)
self.completer = QtGui.QCompleter(self.wordList, self)
self.completer = QtGuiWidgets.QCompleter(self.wordList, self)
self.completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.completer.setMaxVisibleItems(7)
self.text_host.setCompleter(self.completer)
@ -109,7 +109,7 @@ class FrameConnection(QtGui.QWidget):
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
self.wordList = []
self.completer = QtGui.QCompleter(self.wordList, self)
self.completer = QtGuiWidgets.QCompleter(self.wordList, self)
self.completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.completer.setMaxVisibleItems(7)
self.text_host.setCompleter(self.completer)
@ -122,20 +122,20 @@ class FrameConnection(QtGui.QWidget):
grid.addWidget(self.lbl_passwd, 2, 0)
grid.addWidget(self.text_passwd, 2, 1)
self.cmd_connect = QtGui.QPushButton(_('Connect'), self)
self.cmd_connect.setIcon(QtGui.QIcon.fromTheme("network-connect"))
self.cmd_connect = QtGuiWidgets.QPushButton(_('Connect'), self)
self.cmd_connect.setIcon(QtGuiWidgets.QIcon.fromTheme("network-connect"))
self.cmd_connect.setDefault(True)
self.cmd_connect.setAutoDefault(True)
# self.cmd_connect.setMaximumWidth(120)
self.cmd_connect.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
self.cmd_connect.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
self.cmd_cancel = QtGui.QPushButton(_('Cancel'), self)
self.cmd_cancel = QtGuiWidgets.QPushButton(_('Cancel'), self)
# self.cmd_cancel.setMaximumWidth(120)
self.cmd_cancel.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
self.cmd_cancel.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
self.cmd_cancel.clicked.connect(self.close)
layout_button = QtGui.QHBoxLayout()
layout_button = QtGuiWidgets.QHBoxLayout()
layout_button.addWidget(self.cmd_connect)
layout_button.addWidget(self.cmd_cancel)
grid.addLayout(layout_button, 3, 0, 1, 2)
@ -158,7 +158,7 @@ class FrameConnection(QtGui.QWidget):
window.geometry().y() + window.geometry().height() / 2 \
- self.sizeHint().height() / 2)
self.setWindowTitle(_('Connection'))
self.setWindowIcon(QtGui.QIcon.fromTheme("network-connect"))
self.setWindowIcon(QtGuiWidgets.QIcon.fromTheme("network-connect"))
def set_disabled(self):

@ -15,7 +15,7 @@
# limitations under the License.
import socket
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import LabelWordWrap, show_msg
@ -34,9 +34,9 @@ def makePKey(key):
pkey.assign_rsa(key)
return pkey
class RequestCreate (QtGui.QWidget):
class RequestCreate (QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj, key, cert_path, server_host_name):
QtGui.QWidget.__init__(self)
QtGuiWidgets.QWidget.__init__(self)
self.ClientObj = ClientObj
self._parent = parent
@ -44,7 +44,7 @@ class RequestCreate (QtGui.QWidget):
self.cert_path = cert_path
self.server_host_name = server_host_name
self.mainlayout = QtGui.QGridLayout()
self.mainlayout = QtGuiWidgets.QGridLayout()
self.mainlayout.setColumnStretch(0,0)
self.mainlayout.setColumnStretch(1,1)
# Add HostName field
@ -54,7 +54,7 @@ class RequestCreate (QtGui.QWidget):
self.mainlayout.addWidget(LabelWordWrap(_('User@Server_HostName'), \
self),0,0, QtCore.Qt.AlignRight)
self.host_name = QtGui.QLineEdit(result_host_name, self)
self.host_name = QtGuiWidgets.QLineEdit(result_host_name, self)
self.mainlayout.addWidget(self.host_name, 0,1)
# Add UserName field
@ -64,58 +64,58 @@ class RequestCreate (QtGui.QWidget):
username = username.decode('utf-8')
self.mainlayout.addWidget(LabelWordWrap(_('User Name'), self),1,0 \
,QtCore.Qt.AlignRight)
self.user_name = QtGui.QLineEdit(username, self)
self.user_name = QtGuiWidgets.QLineEdit(username, self)
self.mainlayout.addWidget(self.user_name, 1,1)
# Add Organization name field
self.mainlayout.addWidget(QtGui.QLabel(_('Organization Name'), self),\
self.mainlayout.addWidget(QtGuiWidgets.QLabel(_('Organization Name'), self),\
2, 0, QtCore.Qt.AlignRight)
self.org_name = QtGui.QLineEdit('Company', self)
self.org_name = QtGuiWidgets.QLineEdit('Company', self)
self.mainlayout.addWidget(self.org_name, 2,1)
# Add Network address field
self.mainlayout.addWidget(LabelWordWrap(_('Network address'), self), \
3,0,QtCore.Qt.AlignRight)
self.netw_adr = QtGui.QLineEdit(host_name+suffixPort, self)
self.netw_adr = QtGuiWidgets.QLineEdit(host_name+suffixPort, self)
self.mainlayout.addWidget(self.netw_adr, 3,1)
# Add State name field
self.mainlayout.addWidget(LabelWordWrap(_("City"), self),4,0, \
QtCore.Qt.AlignRight)
self.state_name = QtGui.QLineEdit('My_State', self)
self.state_name = QtGuiWidgets.QLineEdit('My_State', self)
self.mainlayout.addWidget(self.state_name, 4,1)
# Add Country field
self.mainlayout.addWidget(LabelWordWrap \
(_('Country (a two-character tag)'), self),
5,0,QtCore.Qt.AlignRight)
self.country = QtGui.QLineEdit('Ru', self)
self.country = QtGuiWidgets.QLineEdit('Ru', self)
# only 2 words
rx = QtCore.QRegExp ("^[a-zA-Z]{0,2}$")
country_validator = QtGui.QRegExpValidator(rx, self)
country_validator = QtGuiWidgets.QRegExpValidator(rx, self)
self.country.setValidator(country_validator)
self.mainlayout.addWidget(self.country, 5,1)
button_layout = QtGui.QHBoxLayout()
button_layout = QtGuiWidgets.QHBoxLayout()
button_layout.setAlignment(QtCore.Qt.AlignRight)
# Add Password field
self.mainlayout.addWidget(LabelWordWrap(_('Password'),\
self), 6,0,QtCore.Qt.AlignRight)
self.passwd_lineedit = QtGui.QLineEdit('', self)
self.passwd_lineedit = QtGuiWidgets.QLineEdit('', self)
self.passwd_lineedit.setEchoMode(self.passwd_lineedit.Password)
self.mainlayout.addWidget(self.passwd_lineedit, 6,1)
# Add create button
self.CreateButton = QtGui.QPushButton(_('Create a signature request'),
self.CreateButton = QtGuiWidgets.QPushButton(_('Create a signature request'),
self)
self.CreateButton.setFixedWidth(self.CreateButton.sizeHint().width())
self.CreateButton.clicked.connect(self.create_req)
button_layout.addWidget(self.CreateButton)
# Add cancel button
self.CancelButton = QtGui.QPushButton(_('Cancel'), self)
self.CancelButton = QtGuiWidgets.QPushButton(_('Cancel'), self)
self.CancelButton.setFixedWidth(self.CancelButton.sizeHint().width())
self.CancelButton.clicked.connect(self.close)
button_layout.addWidget(self.CancelButton)
@ -128,7 +128,7 @@ class RequestCreate (QtGui.QWidget):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setWindowTitle (_('Create a signature request'))
self.setWindowIcon (QtGui.QIcon.fromTheme("view-certificate"))
self.setWindowIcon (QtGuiWidgets.QIcon.fromTheme("view-certificate"))
self.setFocus()
self.move(50+parent.frameGeometry().x(), \

@ -14,15 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import LabelWordWrap, show_msg
import datetime
from calculate.lib.datavars import DataVars
_('The user should not be root')
class HelpWgt(QtGui.QWidget):
class HelpWgt(QtGuiWidgets.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self)
QtGuiWidgets.QWidget.__init__(self)
clVars = DataVars()
clVars.flIniFile()
@ -54,15 +54,15 @@ class HelpWgt(QtGui.QWidget):
linkLabel.setContentsMargins(10,5,10,5)
linkLabel.setOpenExternalLinks(True)
helpQuit = QtGui.QPushButton(_("Close"), self)
helpQuit.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
helpQuit = QtGuiWidgets.QPushButton(_("Close"), self)
helpQuit.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
helpQuit.setFixedWidth(100)
self.image_lbl = QtGui.QLabel(self)
self.image_lbl = QtGuiWidgets.QLabel(self)
filename = '/usr/share/icons/hicolor/scalable/apps/' \
'calculate-console.svg'
ir = QtGui.QImageReader(filename)
ir = QtGuiWidgets.QImageReader(filename)
diff = ir.size().width() / 140.0
w = ir.size().width() / diff
@ -72,11 +72,11 @@ class HelpWgt(QtGui.QWidget):
else:
ir.setScaledSize(QtCore.QSize(w, h))
img = ir.read()
pm2 = QtGui.QPixmap().fromImage(img)
pm2 = QtGuiWidgets.QPixmap().fromImage(img)
self.image_lbl.setPixmap(pm2)
layout = QtGui.QGridLayout(self)
layout = QtGuiWidgets.QGridLayout(self)
layout.setContentsMargins(24,10,24,10)
layout.setAlignment(QtCore.Qt.AlignTop)
@ -91,10 +91,10 @@ class HelpWgt(QtGui.QWidget):
self.setFixedSize(self.sizeHint().width() + 50, \
self.sizeHint().height())
self.setWindowTitle (_('Calculate Console '))
help_icon = QtGui.QIcon \
help_icon = QtGuiWidgets.QIcon \
('/usr/share/pixmaps/calculate-console-online.svg')
if help_icon.isNull():
help_icon = QtGui.QIcon.fromTheme("help-about")
help_icon = QtGuiWidgets.QIcon.fromTheme("help-about")
self.setWindowIcon (help_icon)
self.move(parent.window().geometry().x() + \
@ -116,36 +116,36 @@ import smtplib, re
import email.utils
from email.mime.text import MIMEText
class BugWgt(QtGui.QWidget):
class BugWgt(QtGuiWidgets.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self)
QtGuiWidgets.QWidget.__init__(self)
name_lbl = QtGui.QLabel(_('Your name:'), self)
self.name_edit = QtGui.QLineEdit(self)
name_lbl = QtGuiWidgets.QLabel(_('Your name:'), self)
self.name_edit = QtGuiWidgets.QLineEdit(self)
send_mail_lbl = QtGui.QLabel(_('Your email:') + ' *', self)
send_mail_lbl = QtGuiWidgets.QLabel(_('Your email:') + ' *', self)
send_mail_lbl.setToolTip(_('Please enter a valid email. ') + '\n' + \
_('If the email does not exist, you will receive no letter'))
self.send_mail_edit = QtGui.QLineEdit(self)
self.send_mail_edit = QtGuiWidgets.QLineEdit(self)
self.send_mail_edit.setToolTip(_('Please enter a valid email. ')+'\n'+\
_('If the email does not exist, you will receive no letter'))
subject_lbl = QtGui.QLabel(_('Subject:'), self)
self.subject_edit = QtGui.QLineEdit(self)
subject_lbl = QtGuiWidgets.QLabel(_('Subject:'), self)
self.subject_edit = QtGuiWidgets.QLineEdit(self)
message_lbl = QtGui.QLabel(_('Message:'), self)
self.message_edit = QtGui.QTextEdit(self)
message_lbl = QtGuiWidgets.QLabel(_('Message:'), self)
self.message_edit = QtGuiWidgets.QTextEdit(self)
Send_button = QtGui.QPushButton(_("Send a Bug"), self)
Send_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
Send_button = QtGuiWidgets.QPushButton(_("Send a Bug"), self)
Send_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
Send_button.setMinimumWidth(Send_button.sizeHint().width())
Send_button.clicked.connect(self.send_bug)
Quit_button = QtGui.QPushButton(_("Close"), self)
Quit_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
Quit_button = QtGuiWidgets.QPushButton(_("Close"), self)
Quit_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
Quit_button.clicked.connect(self.close)
layout = QtGui.QGridLayout(self)
layout = QtGuiWidgets.QGridLayout(self)
layout.setColumnStretch(0,0)
layout.setColumnStretch(1,1)
@ -162,7 +162,7 @@ class BugWgt(QtGui.QWidget):
QtCore.Qt.AlignTop)
layout.addWidget(self.message_edit, 3,1, 2, 2)
button_layout = QtGui.QHBoxLayout()
button_layout = QtGuiWidgets.QHBoxLayout()
button_layout.addWidget(Send_button)
button_layout.addWidget(Quit_button)
layout.addLayout(button_layout, 5, 1, 1, 2, QtCore.Qt.AlignRight)
@ -173,8 +173,8 @@ class BugWgt(QtGui.QWidget):
# Set title and icon
self.setWindowTitle (_('Calculate Console '))
bug_icons = ['tools-report-bug','system-help','help-browser']
themeName = QtGui.QIcon.themeName()
bug_icon = QtGui.QIcon()
themeName = QtGuiWidgets.QIcon.themeName()
bug_icon = QtGuiWidgets.QIcon()
for image in bug_icons:
bug_icon.setThemeName(themeName)
bug_icon = bug_icon.fromTheme(image)

@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from PySide.QtGui import QLabel, QLineEdit, QCheckBox, QGroupBox, QComboBox
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from calculate.core.client.function import create_obj, listToArrayArray, \
listToArray
# import analysis
@ -75,9 +74,9 @@ class Table():
tablevalue = TableValue
class RadioButton(QtGui.QRadioButton):
class RadioButton(QtGuiWidgets.QRadioButton):
def __init__(self, text=None, parent=None):
QtGui.QRadioButton.__init__(self, text, parent)
QtGuiWidgets.QRadioButton.__init__(self, text, parent)
def set_data(self, data):
self.data = data
@ -86,7 +85,7 @@ class RadioButton(QtGui.QRadioButton):
return self.data
class MainFrame(QtGui.QWidget):
class MainFrame(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj, view, method_name, \
error_output=True, skip_options=False):
super(MainFrame, self).__init__(parent)
@ -212,12 +211,12 @@ class MainFrame(QtGui.QWidget):
debug(10, "CHANGE OFFSET for", self.method_name)
else:
debug(10, "SHOW NEW FRAME for", self.method_name)
self.common_layout = QtGui.QVBoxLayout(self)
self.common_layout = QtGuiWidgets.QVBoxLayout(self)
self.common_layout.setAlignment(QtCore.Qt.AlignTop)
self.common_layout.setContentsMargins(0, 0, 0, 0)
self.common_layout.setSpacing(0)
self.grid = QtGui.QGridLayout()
self.grid = QtGuiWidgets.QGridLayout()
self.grid.setSpacing(10)
self.grid.setColumnStretch(0, 10)
self.grid.setColumnStretch(1, 17)
@ -539,7 +538,7 @@ class MainFrame(QtGui.QWidget):
# self.grid.setSizeConstraint(self.grid.SizeConstraint.SetMinimumSize)
self.grid.setSizeConstraint(
QtGui.QLayout.SizeConstraint.SetMaximumSize)
QtGuiWidgets.QLayout.SizeConstraint.SetMaximumSize)
# hide expert settings
self.grid.setContentsMargins(28, 28, 28, 28)
@ -563,16 +562,16 @@ class MainFrame(QtGui.QWidget):
self.ClientObj.MainWidget.left_frame.changed_step(
self.ClientObj.param_objects[self.method_name]['step'])
if not lastTable:
self.grid.addItem(QtGui.QSpacerItem(
0, 0, QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding),
self.grid.addItem(QtGuiWidgets.QSpacerItem(
0, 0, QtGuiWidgets.QSizePolicy.Expanding,
QtGuiWidgets.QSizePolicy.Expanding),
x + 1, y, 1, 2)
self.common_layout.addLayout(self.grid)
# add spacer
# self.common_layout.addItem(QtGui.QSpacerItem( 0, 0, \
# QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
# self.common_layout.addItem(QtGuiWidgets.QSpacerItem( 0, 0, \
# QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding))
self.update()
self.ClientObj.app.processEvents()
self.updateGeometry()
@ -706,23 +705,23 @@ class MainFrame(QtGui.QWidget):
self.grid.addWidget(self.label_dict[field.name], x, y)
self.view_dict[field.name] = QLineEdit(self)
self.view_dict[field.name] = QtGuiWidgets.QLineEdit(self)
if field.value:
self.view_dict[field.name].setText(field.value)
if field.type == 'int':
self.rx = QtCore.QRegExp("^[\d]{1,50}$")
self.validator = QtGui.QRegExpValidator(self.rx, self)
self.validator = QtGuiWidgets.QRegExpValidator(self.rx, self)
self.view_dict[field.name].setValidator(self.validator)
elif field.type == 'float':
self.rx = QtCore.QRegExp("^[\d]{1,50}[.][\d]{1,50}$")
self.validator = QtGui.QRegExpValidator(self.rx, self)
self.validator = QtGuiWidgets.QRegExpValidator(self.rx, self)
self.view_dict[field.name].setValidator(self.validator)
# password input
elif "password" in field.type:
self.view_dict[field.name].setEchoMode(QtGui.QLineEdit.Password)
self.view_dict[field.name].setEchoMode(QtGuiWidgets.QLineEdit.Password)
exp = QtGui.QSizePolicy.Policy.Expanding
pref = QtGui.QSizePolicy.Policy.Preferred
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
self.view_dict[field.name].setSizePolicy(exp, pref)
# advanced settings (expert)
if self.expert:
@ -762,7 +761,7 @@ class MainFrame(QtGui.QWidget):
def add_element_check(self, field, x, y, brief=False):
self.error_label_dict[field.name] = ErrorLabel(self)
self.label_dict[field.name] = QLabel(field.label, self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
# set disable item if uncompatible
if field.uncompatible:
self.label_dict[field.name].setToolTip(field.uncompatible)
@ -774,7 +773,7 @@ class MainFrame(QtGui.QWidget):
if brief:
self.view_dict[field.name] = ReadonlyCheckBox(self)
else:
self.view_dict[field.name] = QCheckBox(self)
self.view_dict[field.name] = QtGuiWidgets.QCheckBox(self)
#self.view_dict[field.name].setStyleSheet(
# "QCheckBox:hover {background-color:#FFFFFF}")
@ -813,11 +812,11 @@ class MainFrame(QtGui.QWidget):
self.view_dict[field.name].setDisabled(True)
self.view_dict[field.name].setContentsMargins(0, 0, 0, 0)
check_widget = QtGui.QLabel(self)
exp = QtGui.QSizePolicy.Policy.Expanding
pref = QtGui.QSizePolicy.Policy.Preferred
check_widget = QtGuiWidgets.QLabel(self)
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
check_widget.setSizePolicy(exp, pref)
check_layout = QtGui.QHBoxLayout(check_widget)
check_layout = QtGuiWidgets.QHBoxLayout(check_widget)
check_layout.setContentsMargins(0, 0, 0, 0)
self.view_dict[field.name].setFixedWidth \
(self.view_dict[field.name].sizeHint().width() + 4)
@ -852,7 +851,7 @@ class MainFrame(QtGui.QWidget):
return wrapper
def add_element_radio(self, field, x, y):
self.label_dict[field.name] = QLabel(self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(self)
if field.uncompatible:
self.label_dict[field.name].setToolTip(field.uncompatible)
self.label_dict[field.name].setDisabled(True)
@ -863,7 +862,7 @@ class MainFrame(QtGui.QWidget):
if field.comments:
comments = field.comments[0]
self.GroupBox = QGroupBox(field.label, self)
self.GroupBox = QtGuiWidgets.QGroupBox(field.label, self)
self.GroupBox.setStyleSheet( self.GroupBox.styleSheet() +
"QGroupBox {"
'padding-top: 24px; padding-bottom: 0px;'
@ -884,8 +883,8 @@ class MainFrame(QtGui.QWidget):
'background-color: transparent;'
'subcontrol-position: top center;'
'margin-top: 6px;}')
self.ButGrp_dict[field.name] = QtGui.QButtonGroup(self)
layout = QtGui.QVBoxLayout(self.GroupBox)
self.ButGrp_dict[field.name] = QtGuiWidgets.QButtonGroup(self)
layout = QtGuiWidgets.QVBoxLayout(self.GroupBox)
radiolist = []
if field.value == None:
@ -961,7 +960,7 @@ class MainFrame(QtGui.QWidget):
choice.append(field.value)
# add label
self.label_dict[field.name] = QLabel(field.label, self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
if field.uncompatible:
self.label_dict[field.name].setToolTip(field.uncompatible)
self.label_dict[field.name].setDisabled(True)
@ -992,8 +991,8 @@ class MainFrame(QtGui.QWidget):
self.ComboBox.currentIndexChanged.connect \
(combo_checked(self, field.name))
exp = QtGui.QSizePolicy.Policy.Expanding
pref = QtGui.QSizePolicy.Policy.Preferred
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
self.ComboBox.setSizePolicy(exp, pref)
self.view_dict[field.name] = self.ComboBox
if self.expert:
@ -1052,7 +1051,7 @@ class MainFrame(QtGui.QWidget):
choice.append(field.value)
# add label
self.label_dict[field.name] = QLabel(field.label, self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
if field.uncompatible:
self.label_dict[field.name].setToolTip(field.uncompatible)
self.label_dict[field.name].setDisabled(True)
@ -1061,7 +1060,7 @@ class MainFrame(QtGui.QWidget):
self.ComboBox = QComboWgt(self)
self.ComboBox.setDuplicatesEnabled(False)
self.ComboBox.setEditable(True)
#le = QtGui.QLineEdit(self)
#le = QtGuiWidgets.QLineEdit(self)
#le.setStyleSheet('QLineEdit {background:white;margin: 1px;}')
#self.ComboBox.setLineEdit(le)
for i in range(0, len(choice)):
@ -1080,8 +1079,8 @@ class MainFrame(QtGui.QWidget):
if field.value == choice[i]:
self.ComboBox.setCurrentIndex(i)
exp = QtGui.QSizePolicy.Policy.Expanding
pref = QtGui.QSizePolicy.Policy.Preferred
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
self.ComboBox.setSizePolicy(exp, pref)
self.view_dict[field.name] = self.ComboBox
if self.expert:
@ -1133,7 +1132,7 @@ class MainFrame(QtGui.QWidget):
comments, add_ability,
self.expert)
# add label
self.label_dict[field.name] = QLabel(field.label, self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
if self.expert:
if field.default:
self.expert_list.append(field.name)
@ -1218,7 +1217,7 @@ class MainFrame(QtGui.QWidget):
# return wrapper
def add_element_openfile(self, field, x, y):
self.label_dict[field.name] = QLabel(field.label, self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
self.grid.addWidget(self.label_dict[field.name], x, y)
# field.type in ['file','files','dir']
@ -1252,7 +1251,7 @@ class MainFrame(QtGui.QWidget):
self.grid.addWidget(self.error_label_dict[field.name], x + 1, y, 1, 2)
def add_element_file(self, field, x, y):
self.label_dict[field.name] = QLabel(field.label, self)
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
self.grid.addWidget(self.label_dict[field.name], x, y)
try:
@ -1437,7 +1436,7 @@ class MainFrame(QtGui.QWidget):
reply = show_question(self, text, cursor_pos=True,
title=_('Calculate Console'))
if reply == QtGui.QMessageBox.Yes or not self.changed_expert_list:
if reply == QtGuiWidgets.QMessageBox.Yes or not self.changed_expert_list:
for field_name in self.changed_expert_list:
if field_name not in self.expert_list:
self.expert_list.append(field_name)
@ -1557,7 +1556,7 @@ class MainFrame(QtGui.QWidget):
self.ClientObj.process_dict[meth_result[0].message] \
['name'] = method_name
self.ClientObj.process_dict[meth_result[0].message] \
['layout'] = QtGui.QVBoxLayout()
['layout'] = QtGuiWidgets.QVBoxLayout()
self.ClientObj.process_dict[meth_result[0].message] \
['layout'].setAlignment(QtCore.Qt.AlignTop)
@ -1655,8 +1654,8 @@ class MainFrame(QtGui.QWidget):
self.add_table_items(table, field, lenColumn, self.table_widget, \
brief)
minimum = QtGui.QSizePolicy.Minimum
expanding = QtGui.QSizePolicy.Expanding
minimum = QtGuiWidgets.QSizePolicy.Minimum
expanding = QtGuiWidgets.QSizePolicy.Expanding
self.table_widget.setSizePolicy(minimum, expanding)
self.view_dict[field.name] = self.table_widget
@ -1683,34 +1682,34 @@ class MainFrame(QtGui.QWidget):
self.grid.addWidget(self.label_dict[field.name], x, y, 1, 2)
x += 1
widget_for_grid = QtGui.QWidget(self)
widget_for_grid = QtGuiWidgets.QWidget(self)
if brief:
widget_for_grid.setStyleSheet("background: transparent;")
wfg_layout = QtGui.QVBoxLayout(widget_for_grid)
wfg_layout = QtGuiWidgets.QVBoxLayout(widget_for_grid)
wfg_layout.setSpacing(0)
wfg_layout.setContentsMargins(0, 0, 0, 0)
# add 2 button if field type = writable
if field.type == 'writable':
self.view_dict[field.name].horizontalHeader().setClickable(False)
unit_widget = QtGui.QWidget(self)
unit_layout = QtGui.QHBoxLayout(unit_widget)
unit_widget = QtGuiWidgets.QWidget(self)
unit_layout = QtGuiWidgets.QHBoxLayout(unit_widget)
unit_layout.setContentsMargins(0, 0, 0, 0)
unit_layout.setSpacing(3)
plus_but = QtGui.QPushButton(self)
plus_but = QtGuiWidgets.QPushButton(self)
try:
plus_but.setIcon(QtGui.QIcon.fromTheme('list-add'))
plus_but.setIcon(QtGuiWidgets.QIcon.fromTheme('list-add'))
except:
plus_but.setText('+')
plus_but.setToolTip(_('Add a row'))
plus_but.setFixedWidth(30)
self.view_dict[field.name].minus_but = QtGui.QPushButton(self)
self.view_dict[field.name].minus_but = QtGuiWidgets.QPushButton(self)
try:
self.view_dict[field.name].minus_but.setIcon \
(QtGui.QIcon.fromTheme('list-remove'))
(QtGuiWidgets.QIcon.fromTheme('list-remove'))
except:
self.view_dict[field.name].minus_but.setText('-')
self.view_dict[field.name].minus_but.setToolTip \
@ -1718,18 +1717,18 @@ class MainFrame(QtGui.QWidget):
self.view_dict[field.name].minus_but.setFixedWidth(30)
self.view_dict[field.name].minus_but.setDisabled(True)
refresh_but = QtGui.QPushButton(self)
refresh_but = QtGuiWidgets.QPushButton(self)
try:
refresh_but.setIcon(QtGui.QIcon.fromTheme('edit-undo'))
refresh_but.setIcon(QtGuiWidgets.QIcon.fromTheme('edit-undo'))
except:
refresh_but.setText('R')
refresh_but.setToolTip(_('Recover the table'))
refresh_but.setFixedWidth(30)
clear_but = QtGui.QPushButton(self)
clear_but = QtGuiWidgets.QPushButton(self)
try:
clear_but.setIcon(QtGui.QIcon.fromTheme('edit-clear'))
clear_but.setIcon(QtGuiWidgets.QIcon.fromTheme('edit-clear'))
except:
clear_but.setText('C')
@ -1773,11 +1772,11 @@ class MainFrame(QtGui.QWidget):
# set width column
# self.view_dict[field.name].horizontalHeader().resizeSections\
# (QtGui.QHeaderView.ResizeMode.ResizeToContents)
# (QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
# No Selection
self.view_dict[field.name].setSelectionMode \
(QtGui.QAbstractItemView.SelectionMode.NoSelection)
(QtGuiWidgets.QAbstractItemView.SelectionMode.NoSelection)
if field.uncompatible:
self.label_dict[field.name].setToolTip(field.uncompatible)
@ -1809,36 +1808,36 @@ class MainFrame(QtGui.QWidget):
col = column + 1
if not table.values:
table_widget.setEditTriggers \
(QtGui.QAbstractItemView.NoEditTriggers)
(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
for row in range(len(table.body.stringArray)):
tablewidgetitem = QtGui.QTableWidgetItem \
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
(table.body.stringArray[row].string[column])
table_widget.setItem(row, col, tablewidgetitem)
elif column > (len(table.values.ChoiceValue) - 1):
for row in range(len(table.body.stringArray)):
tablewidgetitem = QtGui.QTableWidgetItem \
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
(table.body.stringArray[row].string[column])
table_widget.setItem(row, col, tablewidgetitem)
table_widget.item(row, col).setFlags(
QtCore.Qt.ItemIsEditable)
brush = QtGui.QBrush(
self.palette().color(QtGui.QPalette.Text))
brush = QtGuiWidgets.QBrush(
self.palette().color(QtGuiWidgets.QPalette.Text))
table_widget.item(row, col).setForeground(brush)
elif brief and table.values.ChoiceValue[column].typefield in \
['combo', 'comboEdit', 'multichoice', \
'multichoice_add', 'input', 'password']:
table_widget.setEditTriggers \
(QtGui.QAbstractItemView.NoEditTriggers)
(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
for row in range(len(table.body.stringArray)):
if table.values.ChoiceValue[column].typefield == \
'password' and table.body.stringArray \
[row].string[column]:
tablewidgetitem = QtGui.QTableWidgetItem('***')
tablewidgetitem = QtGuiWidgets.QTableWidgetItem('***')
else:
tablewidgetitem = QtGui.QTableWidgetItem \
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
(table.body.stringArray[row].string[column])
table_widget.setItem(row, col, tablewidgetitem)
@ -1856,13 +1855,13 @@ class MainFrame(QtGui.QWidget):
if ind < len(ChoiceValue.comments.string):
val = ChoiceValue.comments.string[ind]
tablewidgetitem = QtGui.QTableWidgetItem(val)
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
table_widget.setItem(row, col, tablewidgetitem)
table_widget.item(row, col).setFlags \
(QtCore.Qt.ItemIsEditable)
brush = QtGui.QBrush(
self.palette().color(QtGui.QPalette.Text))
brush = QtGuiWidgets.QBrush(
self.palette().color(QtGuiWidgets.QPalette.Text))
table_widget.item(row, col).setForeground(brush)
elif table.values.ChoiceValue[column].typefield in \
@ -1891,13 +1890,13 @@ class MainFrame(QtGui.QWidget):
value_dict[choice[i]] = choice[i]
val = ','.join(map(lambda x: value_dict[x], default))
tablewidgetitem = QtGui.QTableWidgetItem(val)
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
table_widget.setItem(row, col, tablewidgetitem)
table_widget.item(row, col).setFlags \
(QtCore.Qt.ItemIsEditable)
brush = QtGui.QBrush(
self.palette().color(QtGui.QPalette.Text))
brush = QtGuiWidgets.QBrush(
self.palette().color(QtGuiWidgets.QPalette.Text))
table_widget.item(row, col).setForeground(brush)
elif table.values.ChoiceValue[column].typefield in \
@ -1915,14 +1914,14 @@ class MainFrame(QtGui.QWidget):
elif not val and brief:
data = ''
val = ''
tablewidgetitem = QtGui.QTableWidgetItem(val)
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
tablewidgetitem.setData(1, data)
table_widget.setItem(row, col, tablewidgetitem)
table_widget.item(row, col).setFlags(
QtCore.Qt.ItemIsEditable)
brush = QtGui.QBrush(
self.palette().color(QtGui.QPalette.Text))
brush = QtGuiWidgets.QBrush(
self.palette().color(QtGuiWidgets.QPalette.Text))
table_widget.item(row, col).setForeground(brush)
elif table.values.ChoiceValue[column].typefield in \
@ -1930,27 +1929,27 @@ class MainFrame(QtGui.QWidget):
for row in range(len(table.body.stringArray)):
val = table.body.stringArray[row].string[column]
tablewidgetitem = QtGui.QTableWidgetItem(val)
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
table_widget.setItem(row, col, tablewidgetitem)
table_widget.item(row, col).setFlags(
QtCore.Qt.ItemIsEditable)
brush = QtGui.QBrush(
self.palette().color(QtGui.QPalette.Text))
brush = QtGuiWidgets.QBrush(
self.palette().color(QtGuiWidgets.QPalette.Text))
table_widget.item(row, col).setForeground(brush)
elif table.values.ChoiceValue[column].typefield == 'password':
for row in range(len(table.body.stringArray)):
passwd = table.body.stringArray[row].string[column]
val = '***' if passwd else ''
tablewidgetitem = QtGui.QTableWidgetItem(val)
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
tablewidgetitem.setData(1, passwd)
table_widget.setItem(row, col, tablewidgetitem)
table_widget.item(row, col).setFlags(
QtCore.Qt.ItemIsEditable)
brush = QtGui.QBrush(
self.palette().color(QtGui.QPalette.Text))
brush = QtGuiWidgets.QBrush(
self.palette().color(QtGuiWidgets.QPalette.Text))
table_widget.item(row, col).setForeground(brush)
def add_select_check(self, table):
@ -1967,7 +1966,7 @@ class MainFrame(QtGui.QWidget):
for row in range(table.rowCount()):
if not table.cellWidget(row, 0):
tablewidgetitem = QtGui.QTableWidgetItem()
tablewidgetitem = QtGuiWidgets.QTableWidgetItem()
table.setItem(row, 0, tablewidgetitem)
# table.item(row, 0).setFlags(QtCore.Qt.ItemIsEditable)
@ -2044,7 +2043,7 @@ class MainFrame(QtGui.QWidget):
h += table.rowHeight(row_in_table)
table.setFixedHeight(h)
table.horizontalHeader().resizeSections \
(QtGui.QHeaderView.ResizeMode.ResizeToContents)
(QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
table.setColumnWidth(0, 40)
############# End add Table
@ -2076,10 +2075,10 @@ class MainFrame(QtGui.QWidget):
self.grid.addWidget(help_lbl, x, y, 1, 2)
x += 1
# brief_sa = QtGui.QScrollArea(self)
brief_widget = QtGui.QWidget(self)
# brief_sa = QtGuiWidgets.QScrollArea(self)
brief_widget = QtGuiWidgets.QWidget(self)
self.brief_grid = QtGui.QGridLayout(brief_widget)
self.brief_grid = QtGuiWidgets.QGridLayout(brief_widget)
# self.brief_grid.setContentsMargins(10,10,10,10)
self.brief_grid.setContentsMargins(0, 0, 0, 0)
self.brief_grid.setSpacing(10)
@ -2094,7 +2093,7 @@ class MainFrame(QtGui.QWidget):
brief_widget.setStyleSheet("#Brief_w "
"{background-color: transparent;}")
exp = QtGui.QSizePolicy.Policy.Expanding
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
expert_brief = ExpertWidget(_('View options'), self)
expert_brief.setFlat(True)
@ -2119,10 +2118,10 @@ class MainFrame(QtGui.QWidget):
self.add_image()
# add spacer
self.spacer_item = QtGui.QSpacerItem(0, 0, exp, exp)
self.spacer_item = QtGuiWidgets.QSpacerItem(0, 0, exp, exp)
self.grid.addItem(self.spacer_item)
self.grid.setSizeConstraint \
(QtGui.QLayout.SizeConstraint.SetMaximumSize)
(QtGuiWidgets.QLayout.SizeConstraint.SetMaximumSize)
self.common_layout.addLayout(self.grid)
# Show Control Buttons widget
@ -2155,7 +2154,7 @@ class MainFrame(QtGui.QWidget):
if not Group.fields:
return grid_x
# self.group_name_label = LabelWordWrap(Group.name, self)
GroupBox = QGroupBox(Group.name)
GroupBox = QtGuiWidgets.QGroupBox(Group.name)
GroupBox.setObjectName('GroupBoxBrief')
# brief_widget.setStyleSheet("#Brief_w "
GroupBox.setStyleSheet(
@ -2181,7 +2180,7 @@ class MainFrame(QtGui.QWidget):
'margin-top: 6px;}')
else:
return grid_x
gb_layout = QtGui.QGridLayout(GroupBox)
gb_layout = QtGuiWidgets.QGridLayout(GroupBox)
gb_layout.setContentsMargins(10, 10, 10, 10)
gb_layout.setSpacing(4)
@ -2290,8 +2289,8 @@ class MainFrame(QtGui.QWidget):
else:
uncompatible_count += 1
minimum = QtGui.QSizePolicy.Minimum
maximum = QtGui.QSizePolicy.Maximum
minimum = QtGuiWidgets.QSizePolicy.Minimum
maximum = QtGuiWidgets.QSizePolicy.Maximum
GroupBox.setSizePolicy(minimum, maximum)
if uncompatible_count != len(Fields):
@ -2403,7 +2402,7 @@ class MainFrame(QtGui.QWidget):
debug(10, "SKIP uncompatible", field.name)
continue
if type(self.view_dict[field.name]) == QGroupBox:
if type(self.view_dict[field.name]) == QtGuiWidgets.QGroupBox:
if self.ButGrp_dict[field.name].checkedButton():
param_object[paramname] = (
self.ButGrp_dict[field.name].checkedButton(
@ -2418,7 +2417,7 @@ class MainFrame(QtGui.QWidget):
else:
param_object[paramname] = False
elif type(self.view_dict[field.name]) == QCheckBox:
elif type(self.view_dict[field.name]) == QtGuiWidgets.QCheckBox:
if self.view_dict[field.name].isTristate():
if self.view_dict[field.name].checkState() \
== QtCore.Qt.CheckState.PartiallyChecked:
@ -2434,7 +2433,7 @@ class MainFrame(QtGui.QWidget):
self.view_dict[field.name].isChecked()
elif type(self.view_dict[field.name]) in \
[QComboBox, QComboWgt]:
[QtGuiWidgets.QComboBox, QComboWgt]:
ind = self.view_dict[field.name].currentIndex()
text = self.view_dict[field.name].currentText()
choice = []
@ -2463,7 +2462,7 @@ class MainFrame(QtGui.QWidget):
param_object[paramname] = \
self.view_dict[field.name].currentText()
elif type(self.view_dict[field.name]) == QLineEdit:
elif type(self.view_dict[field.name]) == QtGuiWidgets.QLineEdit:
val = self.view_dict[field.name].text() or ''
param_object[paramname] = self.fix_string_value(val)
@ -2671,7 +2670,7 @@ class MainFrame(QtGui.QWidget):
d = self.ClientObj.process_dict[meth_result[0].message]
d['result'] = meth_result[0]
d['name'] = self.method_name
d['layout'] = QtGui.QVBoxLayout()
d['layout'] = QtGuiWidgets.QVBoxLayout()
d['layout'].setAlignment(QtCore.Qt.AlignTop)
# set new window title
@ -2809,38 +2808,38 @@ class MainFrame(QtGui.QWidget):
self.highlight_element_error(errorfield)
def unhighliht_element_errors(self, field_name):
if type(self.view_dict[field_name]) in [QGroupBox, SelectList]:
if type(self.view_dict[field_name]) in [QtGuiWidgets.QGroupBox, SelectList]:
self.view_dict[field_name].setStyleSheet( \
self.view_dict[field_name].styleSheet().replace('red', 'gray'))
elif type(self.view_dict[field_name]) in [SelectedTableWidget]:
# self.view_dict[field_name].setStyleSheet('QTableWidget { '
# 'border: 1px solid red;}')
self.view_dict[field_name].unsetErrorBorder()
elif type(self.view_dict[field_name]) in [QComboBox]:
elif type(self.view_dict[field_name]) in [QtGuiWidgets.QComboBox]:
self.view_dict[field_name].setStyleSheet('QComboBox { '
'border: 0px solid red;}')
elif type(self.view_dict[field_name]) in [ComboFileWgt, QComboWgt]:
self.view_dict[field_name].unsetErrorBorder()
elif type(self.view_dict[field_name]) == QCheckBox:
elif type(self.view_dict[field_name]) == QtGuiWidgets.QCheckBox:
self.view_dict[field_name].setStyleSheet('QCheckBox { '
'border: 0px solid red;}')
else:
self.view_dict[field_name].setStyleSheet("")
def highlight_element_error(self, field_name):
if type(self.view_dict[field_name]) in [QGroupBox, SelectList]:
if type(self.view_dict[field_name]) in [QtGuiWidgets.QGroupBox, SelectList]:
self.view_dict[field_name].setStyleSheet( \
self.view_dict[field_name].styleSheet().replace('gray', 'red'))
elif type(self.view_dict[field_name]) in [SelectedTableWidget]:
# self.view_dict[field_name].setStyleSheet('QTableWidget { '
# 'border: 1px solid red;}')
self.view_dict[field_name].setErrorBorder()
elif type(self.view_dict[field_name]) in [QComboBox]:
elif type(self.view_dict[field_name]) in [QtGuiWidgets.QComboBox]:
self.view_dict[field_name].setStyleSheet('QComboBox { '
'border: 1px solid red;}')
elif type(self.view_dict[field_name]) in [ComboFileWgt, QComboWgt]:
self.view_dict[field_name].setErrorBorder()
elif type(self.view_dict[field_name]) == QCheckBox:
elif type(self.view_dict[field_name]) == QtGuiWidgets.QCheckBox:
self.view_dict[field_name].setStyleSheet('QCheckBox { '
'border: 1px solid red;}')
else:
@ -2933,7 +2932,7 @@ class MainFrame(QtGui.QWidget):
'''remove value'''
if self.view_dict[field.name].item(row, i):
self.view_dict[field.name].item(row, i).setText('')
elif type(self.view_dict[field.name].cellWidget(row, i)) == QComboBox:
elif type(self.view_dict[field.name].cellWidget(row, i)) == QtGuiWidgets.QComboBox:
try:
self.view_dict[field.name].cellWidget(row, i).setEditText('')
except:
@ -2959,7 +2958,7 @@ class MainFrame(QtGui.QWidget):
except Exception, e:
# _print ('EXCEPT', e)
pass
elif type(self.view_dict[field.name].cellWidget(row, i)) == QComboBox:
elif type(self.view_dict[field.name].cellWidget(row, i)) == QtGuiWidgets.QComboBox:
for q in (table.body.stringArray):
try:
ind = q.string.index(text)

@ -15,15 +15,15 @@
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import TopMenu, HelpMenu#, FlowLayout
class MainMenu(QtGui.QWidget):
class MainMenu(QtGuiWidgets.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
# self.hlayout = FlowLayout(self)
QtGui.QIcon.setThemeName('Calculate')
self.hlayout = QtGui.QHBoxLayout(self)
QtGuiWidgets.QIcon.setThemeName('Calculate')
self.hlayout = QtGuiWidgets.QHBoxLayout(self)
self.hlayout.setAlignment(QtCore.Qt.AlignLeft)
######### Back on one step

File diff suppressed because it is too large Load Diff

@ -15,7 +15,7 @@
# limitations under the License.
from more import get_sid
from PySide import QtGui
from calculate.consolegui.qtwrapper import QtGuiWidgets
from ReturnMessage import ReturnedMessage
import urllib2
@ -25,7 +25,7 @@ import urllib2
# self.message = pid
def show_msg(text, title = None, parent = None):
msgBox = QtGui.QMessageBox(parent)
msgBox = QtGuiWidgets.QMessageBox(parent)
if title:
msgBox.setWindowTitle(title)
if not text:
@ -39,8 +39,8 @@ def show_msg(text, title = None, parent = None):
temp += str(i)+' '
text = temp
msgBox.setText(text)
msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
msgBox.setWindowIcon (QtGui.QIcon('calculate-install.svg'))
msgBox.setStandardButtons(QtGuiWidgets.QMessageBox.Ok)
msgBox.setWindowIcon (QtGuiWidgets.QIcon('calculate-install.svg'))
msgBox.exec_()
client_types = "gui"
@ -96,7 +96,7 @@ def pid_inf(ClientObj, client, sid, pids):
ClientObj.process_dict[pid_str]['status'] = s[0][1]
ClientObj.process_dict[pid_str]['result'] = \
ReturnedMessage("pid", None, pid_str)
# ClientObj.process_dict[pid_str]['layout'] = QtGui.QVBoxLayout()
# ClientObj.process_dict[pid_str]['layout'] = QtGuiWidgets.QVBoxLayout()
def client_pid_info(ClientObj, client, pid):
""" get information about selected process (or about all) """

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
import urllib2
from calculate.lib.utils.tools import Locker
@ -73,10 +73,10 @@ def client_post_cert (client, lang):
except:
pass
class ViewSessionInfo (QtGui.QWidget):
class ViewSessionInfo (QtGuiWidgets.QWidget):
def __init__(self, parent, client, window):
QtGui.QWidget.__init__(self)
self.layout = QtGui.QGridLayout()
QtGuiWidgets.QWidget.__init__(self)
self.layout = QtGuiWidgets.QGridLayout()
sid = get_sid(client)
try:
@ -119,13 +119,13 @@ class ViewSessionInfo (QtGui.QWidget):
self), 8,0,1,2)
# Add clear cache Button
self.clear_cache_button = QtGui.QPushButton \
self.clear_cache_button = QtGuiWidgets.QPushButton \
(_("Clear the session cache"), self)
self.clear_cache_button.clicked.connect(self.clear_cache(client, sid))
self.layout.addWidget(self.clear_cache_button, 9,0)
Quit_button = QtGui.QPushButton(_("Close"), self)
Quit_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
Quit_button = QtGuiWidgets.QPushButton(_("Close"), self)
Quit_button.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
self.layout.addWidget(Quit_button, 9, 1)
self.connect(Quit_button, QtCore.SIGNAL("clicked()"),
@ -134,7 +134,7 @@ class ViewSessionInfo (QtGui.QWidget):
self.setFixedSize(260,200)
self.setLayout(self.layout)
self.setWindowIcon(QtGui.QIcon.fromTheme("document-edit-verify"))
self.setWindowIcon(QtGuiWidgets.QIcon.fromTheme("document-edit-verify"))
self.setWindowTitle(_('Session information'))
self.move(window.geometry().x() + window.geometry().width() / 2 \

@ -14,15 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui, QtCore
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
class StatusLabel(QtGui.QLabel):
class StatusLabel(QtGuiWidgets.QLabel):
def __init__(self, name, parent):
QtGui.QLabel.__init__(self, name, parent)
QtGuiWidgets.QLabel.__init__(self, name, parent)
self.setWordWrap(True)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
class StatusFieldWgt(QtGui.QWidget):
class StatusFieldWgt(QtGuiWidgets.QWidget):
def __init__(self, parent, layout):
super(StatusFieldWgt, self).__init__(parent)
@ -30,12 +30,12 @@ class StatusFieldWgt(QtGui.QWidget):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
class StatusField (QtGui.QScrollArea):
class StatusField (QtGuiWidgets.QScrollArea):
# bottom in main frame
def __init__(self, parent, ClientObj):
QtGui.QScrollArea.__init__(self, parent)
QtGuiWidgets.QScrollArea.__init__(self, parent)
self.layout = QtGui.QVBoxLayout()
self.layout = QtGuiWidgets.QVBoxLayout()
self.status_widget = StatusFieldWgt(self, self.layout)
self.setWidget(self.status_widget)

@ -16,16 +16,15 @@
import os
from PySide import QtGui, QtCore
from PySide.QtGui import QComboBox
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
from more import LabelWordWrap, FileOpenWgt, show_msg, show_question, \
client_list_methods
class ToolsWidget (QtGui.QWidget):
class ToolsWidget (QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj, window):
QtGui.QWidget.__init__(self)
self.vlayout = QtGui.QVBoxLayout(self)
QtGuiWidgets.QWidget.__init__(self)
self.vlayout = QtGuiWidgets.QVBoxLayout(self)
self.vlayout.setAlignment(QtCore.Qt.AlignTop)
self.vlayout.setAlignment(QtCore.Qt.AlignRight)
@ -35,7 +34,7 @@ class ToolsWidget (QtGui.QWidget):
self.setFixedSize(450, 220)
self.setWindowTitle(_('Preferences'))
self.setWindowIcon(QtGui.QIcon.fromTheme("preferences-other"))
self.setWindowIcon(QtGuiWidgets.QIcon.fromTheme("preferences-other"))
# for clear memory after closed this window
self.setAttribute(QtCore.Qt.WA_ShowModal)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
@ -58,8 +57,8 @@ class ToolsWidget (QtGui.QWidget):
del (child)
# Add clear config button
clear_icon = QtGui.QIcon.fromTheme("edit-delete-page")
clear_button = QtGui.QPushButton (clear_icon,
clear_icon = QtGuiWidgets.QIcon.fromTheme("edit-delete-page")
clear_button = QtGuiWidgets.QPushButton (clear_icon,
_('Clear the configuration file'),self)
clear_button.clicked.connect(self.clear_config(parent, ClientObj))
@ -70,27 +69,27 @@ class ToolsWidget (QtGui.QWidget):
self.vlayout.addWidget(tab)
# add ok, apply and cancel button
botton_wgt = QtGui.QWidget(self)
self.botton_layout = QtGui.QHBoxLayout(botton_wgt)
botton_wgt = QtGuiWidgets.QWidget(self)
self.botton_layout = QtGuiWidgets.QHBoxLayout(botton_wgt)
self.botton_layout.setContentsMargins(0,0,0,0)
self.botton_layout.setAlignment(QtCore.Qt.AlignRight)
toolOk = QtGui.QPushButton(_('Ok'), self)
toolOk = QtGuiWidgets.QPushButton(_('Ok'), self)
toolOk.setFixedWidth(50)
toolOk.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return))
toolOk.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Return))
toolOk.clicked.connect(self.save_changes(ClientObj, tab))
toolOk.clicked.connect(self.close)
self.botton_layout.addWidget(toolOk)
toolApply = QtGui.QPushButton(_('Apply'), self)
toolApply = QtGuiWidgets.QPushButton(_('Apply'), self)
toolApply.setFixedWidth(100)
toolApply.clicked.connect(self.save_changes(ClientObj, tab))
self.botton_layout.addWidget(toolApply)
toolQuit = QtGui.QPushButton(_('Cancel'), self)
toolQuit = QtGuiWidgets.QPushButton(_('Cancel'), self)
toolQuit.setFixedWidth(100)
toolQuit.clicked.connect(self.close)
toolQuit.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
toolQuit.setShortcut(QtGuiWidgets.QKeySequence(QtCore.Qt.Key_Escape))
self.botton_layout.addWidget(toolQuit)
self.gui_signal.connect(tab.GuiWidget.save_changes(ClientObj))
@ -124,20 +123,20 @@ class ToolsWidget (QtGui.QWidget):
self.create(parent, ClientObj)
return wrapper
class ToolTabWidget(QtGui.QTabWidget):
class ToolTabWidget(QtGuiWidgets.QTabWidget):
def __init__(self, parent, ClientObj):
QtGui.QTabWidget.__init__(self, parent)
QtGuiWidgets.QTabWidget.__init__(self, parent)
self.ClientObj = ClientObj
self.GuiWidget = ToolGui(self, ClientObj)
self.OtherWidget = ToolOther(self, ClientObj)
self.gui_icon = QtGui.QIcon.fromTheme("video-display")
self.gui_icon = QtGuiWidgets.QIcon.fromTheme("video-display")
self.other_icon = QtGui.QIcon.fromTheme("preferences-other")
self.other_icon = QtGuiWidgets.QIcon.fromTheme("preferences-other")
if self.other_icon.isNull():
self.other_icon = QtGui.QIcon.fromTheme("preferences-desctop")
self.other_icon = QtGuiWidgets.QIcon.fromTheme("preferences-desctop")
self.addTab(self.GuiWidget, self.gui_icon ,_('GUI'))
self.addTab(self.OtherWidget, self.other_icon, _('Other'))
@ -164,7 +163,7 @@ class ToolTabWidget(QtGui.QTabWidget):
reply = show_question(self.parent(), text, informative_text,
title = _('Saving changes'))
if reply == QtGui.QMessageBox.Yes:
if reply == QtGuiWidgets.QMessageBox.Yes:
if self.cur_tab_num == 0:
self.gui_signal.connect \
(self.GuiWidget.save_changes(self.ClientObj))
@ -190,13 +189,13 @@ class ToolTabWidget(QtGui.QTabWidget):
self.changed_flag = False
# Gui tools in ToolTabWidget
class ToolGui(QtGui.QWidget):
class ToolGui(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
self.user_config = ClientObj.user_config
self._parent = parent
self.grid = QtGui.QGridLayout(self)
self.grid = QtGuiWidgets.QGridLayout(self)
self.grid.setContentsMargins(2,2,2,2)
self.grid.setSpacing(2)
@ -208,7 +207,7 @@ class ToolGui(QtGui.QWidget):
self.h_image_lbl = LabelWordWrap(_('Image height'), self)
self.h_image_lbl.setMaximumWidth(self.h_image_lbl.sizeHint().width())
self.h_image_lineedit = QtGui.QLineEdit(self)
self.h_image_lineedit = QtGuiWidgets.QLineEdit(self)
self.h_image_lineedit.setToolTip(_('Set a fixed height image for '
'actions')+' '+_('0: hide images'))
@ -222,7 +221,7 @@ class ToolGui(QtGui.QWidget):
self.count_row_lbl.setMaximumWidth \
(self.count_row_lbl.sizeHint().width())
self.count_row_lineedit = QtGui.QLineEdit(self)
self.count_row_lineedit = QtGuiWidgets.QLineEdit(self)
self.count_row_lineedit.setText(str(ClientObj.count_row_res_table))
@ -230,8 +229,8 @@ class ToolGui(QtGui.QWidget):
self.grid.addWidget(self.count_row_lineedit, 2, 1)
# add spacer
self.grid.addItem(QtGui.QSpacerItem(0,0, QtGui.QSizePolicy.Expanding, \
QtGui.QSizePolicy.Expanding ), 3, 0, 1, 2)
self.grid.addItem(QtGuiWidgets.QSpacerItem(0,0, QtGuiWidgets.QSizePolicy.Expanding, \
QtGuiWidgets.QSizePolicy.Expanding ), 3, 0, 1, 2)
# connect all with change value slot
self.h_image_lineedit.textChanged.connect(self.changed_val)
@ -333,13 +332,13 @@ class ToolGui(QtGui.QWidget):
return wrapper
# Other tools in ToolTabWidget
class ToolOther(QtGui.QWidget):
class ToolOther(QtGuiWidgets.QWidget):
def __init__(self, parent, ClientObj):
QtGui.QWidget.__init__(self, parent)
QtGuiWidgets.QWidget.__init__(self, parent)
self.user_config = ClientObj.user_config
self._parent = parent
self.grid = QtGui.QGridLayout(self)
self.grid = QtGuiWidgets.QGridLayout(self)
self.grid.setContentsMargins(2,2,2,2)
self.grid.setSpacing(2)
@ -350,7 +349,7 @@ class ToolOther(QtGui.QWidget):
self.lang_lbl = LabelWordWrap(_('Select Language'), self)
self.lang_lbl.setMaximumWidth(self.lang_lbl.sizeHint().width())
self.lang_ComboBox = QComboBox(self)
self.lang_ComboBox = QtGuiWidgets.QComboBox(self)
lang_dict = {'en': _('English'),'ru': _('Russian'),'fr':_('French'),
'uk':_('Ukrainian')}
@ -383,7 +382,7 @@ class ToolOther(QtGui.QWidget):
# self.timeout_lbl = LabelWordWrap(_('Timeout'), self)
# self.timeout_lbl.setMaximumWidth(self.timeout_lbl.sizeHint().width())
#
# self.timeout_lineedit = QtGui.QLineEdit(self)
# self.timeout_lineedit = QtGuiWidgets.QLineEdit(self)
#
# self.timeout_lineedit.setText(str(ClientObj.timeout))
#
@ -391,8 +390,8 @@ class ToolOther(QtGui.QWidget):
# self.grid.addWidget(self.timeout_lineedit, 2, 1)
# add spacer
self.grid.addItem(QtGui.QSpacerItem(0,0, QtGui.QSizePolicy.Expanding, \
QtGui.QSizePolicy.Expanding ), 5, 0, 1, 2)
self.grid.addItem(QtGuiWidgets.QSpacerItem(0,0, QtGuiWidgets.QSizePolicy.Expanding, \
QtGuiWidgets.QSizePolicy.Expanding ), 5, 0, 1, 2)
# connect all with change value slot
self.lang_ComboBox.currentIndexChanged.connect(self.changed_val)

@ -0,0 +1,90 @@
#-*- coding: utf-8 -*-
# Copyright 2018 Mir Calculate. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtGui as QtGuiOrig, QtCore as QtCoreOrig
class QtGuiWidgets(object):
QAbstractItemView = QtGuiOrig.QAbstractItemView
QAction = QtGuiOrig.QAction
QApplication = QtGuiOrig.QApplication
QBrush = QtGuiOrig.QBrush
QButtonGroup = QtGuiOrig.QButtonGroup
QCheckBox = QtGuiOrig.QCheckBox
QColor = QtGuiOrig.QColor
QComboBox = QtGuiOrig.QComboBox
QCompleter = QtGuiOrig.QCompleter
QCursor = QtGuiOrig.QCursor
QDesktopServices = QtGuiOrig.QDesktopServices
QDialog = QtGuiOrig.QDialog
QFileDialog = QtGuiOrig.QFileDialog
QFontMetrics = QtGuiOrig.QFontMetrics
QFont = QtGuiOrig.QFont
QFrame = QtGuiOrig.QFrame
QGridLayout = QtGuiOrig.QGridLayout
QGroupBox = QtGuiOrig.QGroupBox
QHBoxLayout = QtGuiOrig.QHBoxLayout
QHeaderView = QtGuiOrig.QHeaderView
QIcon = QtGuiOrig.QIcon
QImageReader = QtGuiOrig.QImageReader
QIntValidator = QtGuiOrig.QIntValidator
QKeySequence = QtGuiOrig.QKeySequence
QKeySequence = QtGuiOrig.QKeySequence
QLabel = QtGuiOrig.QLabel
QLayout = QtGuiOrig.QLayout
QLineEdit = QtGuiOrig.QLineEdit
QListWidget = QtGuiOrig.QListWidget
QMainWindow = QtGuiOrig.QMainWindow
QMenu = QtGuiOrig.QMenu
QMessageBox = QtGuiOrig.QMessageBox
QPainter = QtGuiOrig.QPainter
QPalette = QtGuiOrig.QPalette
QPixmap = QtGuiOrig.QPixmap
QProgressBar = QtGuiOrig.QProgressBar
QPushButton = QtGuiOrig.QPushButton
QRadioButton = QtGuiOrig.QRadioButton
QRegExpValidator = QtGuiOrig.QRegExpValidator
QScrollArea = QtGuiOrig.QScrollArea
QSizePolicy = QtGuiOrig.QSizePolicy
QSpacerItem = QtGuiOrig.QSpacerItem
QStyledItemDelegate = QtGuiOrig.QStyledItemDelegate
QStyleOptionViewItemV4 = QtGuiOrig.QStyleOptionViewItemV4
QStyle = QtGuiOrig.QStyle
QSystemTrayIcon = QtGuiOrig.QSystemTrayIcon
QTabBar = QtGuiOrig.QTabBar
QTableView = QtGuiOrig.QTableView
QTableWidgetItem = QtGuiOrig.QTableWidgetItem
QTableWidget = QtGuiOrig.QTableWidget
QTabWidget = QtGuiOrig.QTabWidget
QTextEdit = QtGuiOrig.QTextEdit
QToolButton = QtGuiOrig.QToolButton
QTransform = QtGuiOrig.QTransform
QVBoxLayout = QtGuiOrig.QVBoxLayout
QWidget = QtGuiOrig.QWidget
class QtCore(object):
QObject = QtCoreOrig.QObject
QPoint = QtCoreOrig.QPoint
QRect = QtCoreOrig.QRect
QRegExp = QtCoreOrig.QRegExp
QSize = QtCoreOrig.QSize
Qt = QtCoreOrig.Qt
QThread = QtCoreOrig.QThread
QTimer = QtCoreOrig.QTimer
QUrl = QtCoreOrig.QUrl
Signal = QtCoreOrig.Signal
SIGNAL = QtCoreOrig.SIGNAL
SLOT = QtCoreOrig.SLOT
Loading…
Cancel
Save