class Ui_CedulaPadronDialogBase(object):
    def setupUi(self, CedulaPadronDialogBase):
        CedulaPadronDialogBase.setObjectName("CedulaPadronDialogBase")
        CedulaPadronDialogBase.resize(931, 746)
        self.tabWidget = TabWidget(CedulaPadronDialogBase)
        self.tabWidget.setGeometry(QtCore.QRect(20, 20, 891, 711))
        self.tabWidget.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.tabWidget.setTabPosition(QtWidgets.QTabWidget.West)
        self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)
        self.tabWidget.setElideMode(QtCore.Qt.ElideRight)
        self.tabWidget.setTabsClosable(False)
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.tabWidget.addTab(self.tab_2, "")

        self.retranslateUi(CedulaPadronDialogBase)
        self.tabWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(CedulaPadronDialogBase)

    def retranslateUi(self, CedulaPadronDialogBase):
        _translate = QtCore.QCoreApplication.translate
        CedulaPadronDialogBase.setWindowTitle(
            _translate("CedulaPadronDialogBase", "CedulaPadron"))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.tab),
            _translate("CedulaPadronDialogBase", "UBICACION"))
        self.tabWidget.setTabText(
            self.tabWidget.indexOf(self.tab_2),
            _translate("CedulaPadronDialogBase", "Tab 2"))
Esempio n. 2
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(531, 382)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tabWidget = TabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(20, 20, 491, 321))
        self.tabWidget.setTabPosition(QtWidgets.QTabWidget.West)
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.tabWidget.addTab(self.tab_2, "")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 531, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Tab 1"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2"))
class AboutWidget(QWidget):
       
    def __init__(self,parent = None):
        super(AboutWidget,self).__init__(parent)
        self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)
        #self.setWindowModality(Qt.WindowModal)
        self.tabWidget = TabWidget(self)
        self.aboutTab = AboutTab()
        self.tabWidget.addTab(self.aboutTab,self.tr("About"))
        self.tabWidget.setHasUnderLine(False)
        
        mainLayout = QVBoxLayout()
        mainLayout.setMargin(0)
        mainLayout.setSpacing(0)
        mainLayout.addWidget(self.tabWidget)
        self.setLayout(mainLayout)
        
        self.mousePressed = False
        
        self.tabWidget.closeBtn().installEventFilter(self)
    
        self.connect(self.tabWidget, SIGNAL("closeWidget"),self.close)
    
    def updateWindow(self):
#         m_pTranslator = QTranslator()
#         exePath = "/root/workspace/nwclient/"
#         language1 = "chinese"
#         if language1 == "chinese":
#             QmName = "zh_CN.qm"
#         else:
#             QmName = "en_US.qm"
#             
#         if(m_pTranslator.load(QmName, exePath)):
#             QCoreApplication.instance().installTranslator(m_pTranslator)
            
        self.aboutTab.updateWindow()
        self.tabWidget.removeTab(0)
        self.tabWidget.addTab(self.aboutTab,self.tr("About"))
        
    def eventFilter(self, target, event):
        if target == self.tabWidget.closeBtn():
            if event.type() == QEvent.Enter:
                self.tabWidget.closeBtn().setStyleSheet("background:rgb(255, 255, 255)")
                self.tabWidget.closeBtn().setAutoFillBackground(True);
            elif event.type() == QEvent.Leave:
                self.tabWidget.closeBtn().setAutoFillBackground(False);
                return True
            
        return QWidget.eventFilter(self, target, event)
    
    # 添加鼠标移动窗口
    def mouseMoveEvent(self,event):
        if self.mousePressed:
            self.move(self.pos() + event.pos() - self.currentPos)
   
    def mousePressEvent(self,event):
        if event.buttons() == Qt.LeftButton:
            self.currentPos = event.pos()
            self.mousePressed = True
   
    def mouseReleaseEvent(self,event):
        if event.buttons() == Qt.LeftButton:
            self.mousePressed = False
            
    def paintEvent(self,event):
        painterBack = QPainter(self)
        backBrush = QBrush(QColor(244,250,250))
        painterBack.setBrush(backBrush)
        backRect = QRect(0,0,self.width(),self.height())
        painterBack.fillRect(backRect, backBrush)