예제 #1
0
    def __init__(self):
        super(GoogleChat, self).__init__()

        self.userName = ""
        self.password = ""

        self.form = Ui_Form()
        self.form.setupUi(self)

        self.setFixedSize(320, 480)

        self.form.userNameEdit.setFocus()
        self.form.userNameEdit.textChanged.connect(self.adjustLoginButton)
        self.form.userNameEdit.returnPressed.connect(self.inputPassword)

        self.form.passwordEdit.textChanged.connect(self.adjustLoginButton)
        self.form.passwordEdit.returnPressed.connect(self.doLogin)

        self.form.loginButton.setEnabled(False)
        self.form.loginButton.clicked.connect(self.doLogin)

        self.form.webView.loadFinished.connect(self.initialPage)
        self.form.webView.loadProgress.connect(self.form.progressBar.setValue)
        self.form.webView.setUrl(QtCore.QUrl(GoogleChat.URL))
        self.form.webView.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)

        self.showStatus("Wait...")
예제 #2
0
    def __init__(self, parent=None):
        super(QWidget, self).__init__(parent)

        self.m_iconSize = QSize(64, 64)
        self.m_scene = QGraphicsScene()
        self.m_ui = Ui_Form()

        self.m_ui.setupUi(self)
        self.m_ui.easingCurvePicker.setIconSize(self.m_iconSize)
        self.m_ui.easingCurvePicker.setMinimumHeight(self.m_iconSize.height() + 50)
        self.m_ui.buttonGroup.setId(self.m_ui.lineRadio, 0)
        self.m_ui.buttonGroup.setId(self.m_ui.circleRadio, 1)

        dummy = QEasingCurve()
        self.m_ui.periodSpinBox.setValue(dummy.period())
        self.m_ui.amplitudeSpinBox.setValue(dummy.amplitude())
        self.m_ui.overshootSpinBox.setValue(dummy.overshoot())

        self.m_ui.easingCurvePicker.currentRowChanged.connect(self.curveChanged)
        self.m_ui.buttonGroup.buttonClicked[int].connect(self.pathChanged)
        self.m_ui.periodSpinBox.valueChanged.connect(self.periodChanged)
        self.m_ui.amplitudeSpinBox.valueChanged.connect(self.amplitudeChanged)
        self.m_ui.overshootSpinBox.valueChanged.connect(self.overshootChanged)
        self.createCurveIcons()

        pix = QPixmap(':/images/qt-logo.png')
        self.m_item = PixmapItem(pix)
        self.m_scene.addItem(self.m_item.pixmap_item)
        self.m_ui.graphicsView.setScene(self.m_scene)

        self.m_anim = Animation(self.m_item, b'pos')
        self.m_anim.setEasingCurve(QEasingCurve.OutBounce)
        self.m_ui.easingCurvePicker.setCurrentRow(int(QEasingCurve.OutBounce))

        self.startAnimation()
예제 #3
0
 def __init__(self):
     super(RSA, self).__init__()
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.ui.generateKeysButton.clicked.connect(self.generateKeysSignal)
     self.ui.encryptButton.clicked.connect(self.encryptSignal)
     self.ui.decryptButton.clicked.connect(self.decryptSignal)
예제 #4
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.Lab = 'my new lab'
     # self.ui.LabHello.setText(self.Lab)
     self.ui.label.setText(self.Lab)
     self.ui.pushButton.clicked.connect(self.clicked)
예제 #5
0
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        # Install the custom output stream
        sys.stdout = EmittingStream(textWritten=self.normalOutputWritten)

        self.ui = Ui_Form()
        self.ui.setupUi(self)

        self.ui.pushButton_run.clicked.connect(self.start_task)
        self.finished.connect(self.end_task)
        self.updateProgress.connect(self.ui.progressBar.setValue)
예제 #6
0
 def __init__(self,
              parent=None,
              rut=None,
              nombres=None,
              apellidos=None,
              ficha=None):
     super(FormMedico, self).__init__(parent)
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     if rut is None:  # Cuando no recibe rut crea, cuando recibe edita
         self.ui.save.clicked.connect(self.crear_medico)
     else:
         self.colocar_datos(rut, nombres, apellidos, ficha)
         self.ui.save.clicked.connect(self.editar_mdco)
         self.ui.cancel.clicked.connect(self.exitform)
예제 #7
0
 def __init__(self):
     super(Sort, self).__init__()
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     self.ui.sortButton.clicked.connect(self.sortArray)
예제 #8
0
    def __init__(self, size, parent=None):
        super(PadNavigator, self).__init__(parent)

        self.form = Ui_Form()

        splash = SplashItem()
        splash.setZValue(1)

        pad = FlippablePad(size)
        flipRotation = QGraphicsRotation(pad)
        xRotation = QGraphicsRotation(pad)
        yRotation = QGraphicsRotation(pad)
        flipRotation.setAxis(Qt.YAxis)
        xRotation.setAxis(Qt.YAxis)
        yRotation.setAxis(Qt.XAxis)
        pad.setTransformations([flipRotation, xRotation, yRotation])

        backItem = QGraphicsProxyWidget(pad)
        widget = QWidget()
        self.form.setupUi(widget)
        self.form.hostName.setFocus()
        backItem.setWidget(widget)
        backItem.setVisible(False)
        backItem.setFocus()
        backItem.setCacheMode(QGraphicsItem.ItemCoordinateCache)
        r = backItem.rect()
        backItem.setTransform(QTransform().rotate(180, Qt.YAxis).translate(
            -r.width() / 2, -r.height() / 2))

        selectionItem = RoundRectItem(QRectF(-60, -60, 120, 120),
                                      QColor(Qt.gray), pad)
        selectionItem.setZValue(0.5)

        smoothSplashMove = QPropertyAnimation(splash, "y")
        smoothSplashOpacity = QPropertyAnimation(splash, "opacity")
        smoothSplashMove.setEasingCurve(QEasingCurve.InQuad)
        smoothSplashMove.setDuration(250)
        smoothSplashOpacity.setDuration(250)

        smoothXSelection = QPropertyAnimation(selectionItem, "x")
        smoothYSelection = QPropertyAnimation(selectionItem, "y")
        smoothXRotation = QPropertyAnimation(xRotation, "angle")
        smoothYRotation = QPropertyAnimation(yRotation, "angle")
        smoothXSelection.setDuration(125)
        smoothYSelection.setDuration(125)
        smoothXRotation.setDuration(125)
        smoothYRotation.setDuration(125)
        smoothXSelection.setEasingCurve(QEasingCurve.InOutQuad)
        smoothYSelection.setEasingCurve(QEasingCurve.InOutQuad)
        smoothXRotation.setEasingCurve(QEasingCurve.InOutQuad)
        smoothYRotation.setEasingCurve(QEasingCurve.InOutQuad)

        smoothFlipRotation = QPropertyAnimation(flipRotation, "angle")
        smoothFlipScale = QPropertyAnimation(pad, "scale")
        smoothFlipXRotation = QPropertyAnimation(xRotation, "angle")
        smoothFlipYRotation = QPropertyAnimation(yRotation, "angle")
        flipAnimation = QParallelAnimationGroup(self)
        smoothFlipScale.setDuration(500)
        smoothFlipRotation.setDuration(500)
        smoothFlipXRotation.setDuration(500)
        smoothFlipYRotation.setDuration(500)
        smoothFlipScale.setEasingCurve(QEasingCurve.InOutQuad)
        smoothFlipRotation.setEasingCurve(QEasingCurve.InOutQuad)
        smoothFlipXRotation.setEasingCurve(QEasingCurve.InOutQuad)
        smoothFlipYRotation.setEasingCurve(QEasingCurve.InOutQuad)
        smoothFlipScale.setKeyValueAt(0, 1.0)
        smoothFlipScale.setKeyValueAt(0.5, 0.7)
        smoothFlipScale.setKeyValueAt(1, 1.0)
        flipAnimation.addAnimation(smoothFlipRotation)
        flipAnimation.addAnimation(smoothFlipScale)
        flipAnimation.addAnimation(smoothFlipXRotation)
        flipAnimation.addAnimation(smoothFlipYRotation)

        setVariablesSequence = QSequentialAnimationGroup()
        setFillAnimation = QPropertyAnimation(pad, "fill")
        setBackItemVisibleAnimation = QPropertyAnimation(backItem, "visible")
        setSelectionItemVisibleAnimation = QPropertyAnimation(
            selectionItem, "visible")
        setFillAnimation.setDuration(0)
        setBackItemVisibleAnimation.setDuration(0)
        setSelectionItemVisibleAnimation.setDuration(0)
        setVariablesSequence.addPause(250)
        setVariablesSequence.addAnimation(setBackItemVisibleAnimation)
        setVariablesSequence.addAnimation(setSelectionItemVisibleAnimation)
        setVariablesSequence.addAnimation(setFillAnimation)
        flipAnimation.addAnimation(setVariablesSequence)

        stateMachine = QStateMachine(self)
        splashState = QState(stateMachine)
        frontState = QState(stateMachine)
        historyState = QHistoryState(frontState)
        backState = QState(stateMachine)

        frontState.assignProperty(pad, "fill", False)
        frontState.assignProperty(splash, "opacity", 0.0)
        frontState.assignProperty(backItem, "visible", False)
        frontState.assignProperty(flipRotation, "angle", 0.0)
        frontState.assignProperty(selectionItem, "visible", True)

        backState.assignProperty(pad, "fill", True)
        backState.assignProperty(backItem, "visible", True)
        backState.assignProperty(xRotation, "angle", 0.0)
        backState.assignProperty(yRotation, "angle", 0.0)
        backState.assignProperty(flipRotation, "angle", 180.0)
        backState.assignProperty(selectionItem, "visible", False)

        stateMachine.addDefaultAnimation(smoothXRotation)
        stateMachine.addDefaultAnimation(smoothYRotation)
        stateMachine.addDefaultAnimation(smoothXSelection)
        stateMachine.addDefaultAnimation(smoothYSelection)
        stateMachine.setInitialState(splashState)

        anyKeyTransition = QEventTransition(self, QEvent.KeyPress, splashState)
        anyKeyTransition.setTargetState(frontState)
        anyKeyTransition.addAnimation(smoothSplashMove)
        anyKeyTransition.addAnimation(smoothSplashOpacity)

        enterTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                              Qt.Key_Enter, backState)
        returnTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                               Qt.Key_Return, backState)
        backEnterTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                                  Qt.Key_Enter, frontState)
        backReturnTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                                   Qt.Key_Return, frontState)
        enterTransition.setTargetState(historyState)
        returnTransition.setTargetState(historyState)
        backEnterTransition.setTargetState(backState)
        backReturnTransition.setTargetState(backState)
        enterTransition.addAnimation(flipAnimation)
        returnTransition.addAnimation(flipAnimation)
        backEnterTransition.addAnimation(flipAnimation)
        backReturnTransition.addAnimation(flipAnimation)

        columns = size.width()
        rows = size.height()
        stateGrid = []
        for y in range(rows):
            stateGrid.append([QState(frontState) for _ in range(columns)])

        frontState.setInitialState(stateGrid[0][0])
        selectionItem.setPos(pad.iconAt(0, 0).pos())

        for y in range(rows):
            for x in range(columns):
                state = stateGrid[y][x]

                rightTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                                      Qt.Key_Right, state)
                leftTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                                     Qt.Key_Left, state)
                downTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                                     Qt.Key_Down, state)
                upTransition = QKeyEventTransition(self, QEvent.KeyPress,
                                                   Qt.Key_Up, state)

                rightTransition.setTargetState(stateGrid[y][(x + 1) % columns])
                leftTransition.setTargetState(
                    stateGrid[y][((x - 1) + columns) % columns])
                downTransition.setTargetState(stateGrid[(y + 1) % rows][x])
                upTransition.setTargetState(stateGrid[((y - 1) + rows) %
                                                      rows][x])

                icon = pad.iconAt(x, y)
                state.assignProperty(xRotation, "angle", -icon.x() / 6.0)
                state.assignProperty(yRotation, "angle", icon.y() / 6.0)
                state.assignProperty(selectionItem, "x", icon.x())
                state.assignProperty(selectionItem, "y", icon.y())
                frontState.assignProperty(icon, "visible", True)
                backState.assignProperty(icon, "visible", False)

                setIconVisibleAnimation = QPropertyAnimation(icon, "visible")
                setIconVisibleAnimation.setDuration(0)
                setVariablesSequence.addAnimation(setIconVisibleAnimation)

        scene = QGraphicsScene(self)
        scene.setBackgroundBrush(
            QBrush(QPixmap(":/images/blue_angle_swirl.jpg")))
        scene.setItemIndexMethod(QGraphicsScene.NoIndex)
        scene.addItem(pad)
        scene.setSceneRect(scene.itemsBoundingRect())
        self.setScene(scene)

        sbr = splash.boundingRect()
        splash.setPos(-sbr.width() / 2, scene.sceneRect().top() - 2)
        frontState.assignProperty(splash, "y", splash.y() - 100.0)
        scene.addItem(splash)

        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setMinimumSize(50, 50)
        self.setViewportUpdateMode(QGraphicsView.FullViewportUpdate)
        self.setCacheMode(QGraphicsView.CacheBackground)
        self.setRenderHints(QPainter.Antialiasing
                            | QPainter.SmoothPixmapTransform
                            | QPainter.TextAntialiasing)

        if QGLFormat.hasOpenGL():
            self.setViewport(QGLWidget(QGLFormat(QGL.SampleBuffers)))

        stateMachine.start()