From d3970ff9b8c7c90d80ddd01f581c523706b493b4 Mon Sep 17 00:00:00 2001 From: Denis Spiridonov Date: Thu, 14 Jun 2012 09:32:05 +0400 Subject: [PATCH] fix last tab style --- consolegui/application/ConnectionTabs.py | 19 +++++++++++++------ consolegui/application/more.py | 23 +++++++++-------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/consolegui/application/ConnectionTabs.py b/consolegui/application/ConnectionTabs.py index b49186c..1ec93b6 100644 --- a/consolegui/application/ConnectionTabs.py +++ b/consolegui/application/ConnectionTabs.py @@ -9,7 +9,7 @@ import sudsds, time, sys from TrayIcon import TrayIcon -from more import show_question, get_sid, get_view_params +from more import get_sid, get_view_params from MainClass import ApiClient from calculate.consolegui.datavars import DataVarsGui from pid_information import client_pid_info @@ -31,7 +31,7 @@ class SelectedMethodWgt(QtGui.QWidget): self.setWindowIcon(QtGui.QIcon('/usr/share/pixmaps/calculate3.png')) if self.connect(): - return + sys.exit(1) # definition of screen resolution prim_screen = app.desktop().primaryScreen() d_size = app.desktop().screenGeometry(prim_screen).size() @@ -227,8 +227,7 @@ class ToolTabWidget(QtGui.QTabWidget): self.setMinimumWidth(450) self.setWindowTitle(self.Name) - self.setStyleSheet( - ''' + self.setStyleSheet(''' QTabBar::tab:last { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, @@ -237,8 +236,12 @@ class ToolTabWidget(QtGui.QTabWidget): border-bottom-color: #C2C7CB; border-top-left-radius: 4px; border-top-right-radius: 4px; padding-left: 3px; - margin-left: 3px; margin-bottom: 5px; margin-top: 2px; width: 18px; - }''') + margin-left: 3px; margin-bottom: 5px; margin-top: 2px; width: 18px;} + QTabBar::tab:last::hover {background: + qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #E9E9E9, stop: 0.4 #E5E5E5, + stop: 0.5 #E1E1E1, stop: 1.0 #DDDDDD);} + ''') self.setWindowIcon(QtGui.QIcon('/usr/share/pixmaps/calculate3.png')) self.show() @@ -314,6 +317,10 @@ class ToolTabWidget(QtGui.QTabWidget): self.insertTab(self.count() - 1, widget, self.gui_icon , \ self.new_con_txt) self.setCurrentIndex(self.count() - 2) + if self.currentWidget().ClientObj.client: + self.tabbar.setTabEnabled(self.count() - 1, True) + else: + self.tabbar.setTabEnabled(self.count() - 1, False) def rename_tab(self, text = None, ind = None): if not text: diff --git a/consolegui/application/more.py b/consolegui/application/more.py index f8c5eb1..4c5b8c1 100755 --- a/consolegui/application/more.py +++ b/consolegui/application/more.py @@ -1560,7 +1560,7 @@ class ExpertWidget (QtGui.QPushButton): pm = pm.transformed(QtGui.QTransform().rotate(90)) self.image_lbl.setPixmap(pm) self.image_lbl.setAlignment(QtCore.Qt.AlignCenter) - + # add transparency self.image_lbl.setAttribute(QtCore.Qt.WA_NoSystemBackground) @@ -1783,7 +1783,7 @@ class PlusRow (QtGui.QWidget): self.ComboBox.setItemData(ch, values[ch]) if text and text == values[ch]: self.ComboBox.setCurrentIndex(self.ComboBox.count()-1) - + if not text in values and text != None: self.ComboBox.addItem(text) self.ComboBox.setItemData(self.ComboBox.count(), text) @@ -1806,7 +1806,7 @@ class PlusRow (QtGui.QWidget): text = self.table.item(num_row, col).text() default = text.split(',') def_res = [] - + if comments and hasattr (comments, 'string'): comm = comments.string else: comm = [] @@ -2026,9 +2026,8 @@ class PasswordWgt(QtGui.QWidget): super(PasswordWgt, self).__init__() self._parent = parent self.text = text - self.layout = QtGui.QGridLayout(self) - + self.pass_edit = QtGui.QLineEdit(self) self.pass_edit.setEchoMode(self.pass_edit.Password) @@ -2037,28 +2036,24 @@ class PasswordWgt(QtGui.QWidget): self.pass_edit2 = QtGui.QLineEdit(self) self.pass_edit2.setEchoMode(self.pass_edit2.Password) - + self.layout.addWidget(LabelWordWrap(_('Repeat'), self), 1, 0) self.layout.addWidget(self.pass_edit2, 1, 1) self.pass_edit.textChanged.connect(self.check_passwd) self.pass_edit2.textChanged.connect(self.check_passwd) - self.ok_button = QtGui.QPushButton(_('Ok'), self) self.ok_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return)) self.ok_button.clicked.connect(self.send_password) - self.layout.addWidget(self.ok_button,2,0) self.cancel_button = QtGui.QPushButton(_('Cancel'), self) self.cancel_button.setShortcut(QtGui.QKeySequence \ (QtCore.Qt.Key_Escape)) self.cancel_button.clicked.connect(self.close) - self.layout.addWidget(self.cancel_button,2,1) - self.move(QtGui.QCursor.pos()) - + def send_password(self): password = self.pass_edit.text() if password == self.pass_edit2.text(): @@ -2297,7 +2292,7 @@ def show_question(parent, text, informative_text = None, cursor_pos = False, else: msgBox.move(parent.frameGeometry().x()+parent.size().width()/2 - 150,\ parent.frameGeometry().y() + parent.size().height()/2 - 100) - + reply = msgBox.exec_() return reply @@ -2327,13 +2322,13 @@ def client_post_auth(client): show_msg (e.value) return 1 return 0 - + class ClientSignal(QtCore.QThread): sid_sig = QtCore.Signal(int, int) def __init__(self, ClientObj): QtCore.QThread.__init__(self) self.ClientObj = ClientObj - + def run(self): self.exit_flag = False try: