Ejemplo n.º 1
0
    def __init__(self, editor):
        super(MiniMap, self).__init__(editor)
        self._editor = editor
        self.SendScintilla(QsciScintilla.SCI_SETCARETSTYLE, 0)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETZOOM, -10)
        self.SendScintilla(QsciScintilla.SCI_SETREADONLY, 1)
        self.SendScintilla(QsciScintilla.SCI_HIDESELECTION, 1)
        self.SendScintilla(QsciScintilla.SCI_SETCURSOR, 8)
        # Hide markers
        for i in range(1, 5):
            self.SendScintilla(QsciScintilla.SCI_MARKERDEFINE, i,
                               QsciScintilla.SC_MARK_EMPTY)
        self.SendScintilla(QsciScintilla.SCI_SETMARGINWIDTHN, 1, 0)

        self.setMouseTracking(True)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")
            self.animation.setDuration(300)

        self.slider = SliderArea(self)
        self.slider.show()
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        super(FileSelector, self).__init__(parent,
                                           Qt.Dialog | Qt.FramelessWindowHint)
        self.setObjectName("file-selector")
        self._files = {}
        self.effect = QGraphicsOpacityEffect()
        self.setGraphicsEffect(self.effect)
        self.animation = QPropertyAnimation(self.effect, "opacity")
        self.animation.setDuration(1500)
        box = QVBoxLayout(self)
        box.setSpacing(30)
        self.list_of_files = QListWidget()
        self.list_of_files.setObjectName("list-selector")
        box.addWidget(self.list_of_files)
        self.label_path = QLabel()
        box.addWidget(self.label_path)
        self._load_files()

        self.connect(self.list_of_files,
                     SIGNAL("itemSelectionChanged()"),
                     self._update_label)
        self.connect(self.list_of_files,
                     SIGNAL("itemActivated(QListWidgetItem*)"),
                     self._open_file)
        self.connect(self.list_of_files,
                     SIGNAL("itemEntered(QListWidgetItem*)"),
                     self._open_file)
Ejemplo n.º 3
0
    def __init__(self, parent):
        super(HtmlViewerWidget, self).__init__(parent)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.view = QWebView()
        self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.frame = QFrame()
        self.frame.setLayout(QGridLayout())
        self.frame.layout().setContentsMargins(0, 0, 0, 0)

        self.toolbar = QToolBar()
        self.spacer = QWidget()
        self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"),
                                                 "Copy Text")
        self.label = QLabel()
        self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"),
                                                  "Close")
        self.spaceraction = self.toolbar.insertWidget(self.closeAction,
                                                      self.spacer)
        self.labelaction = self.toolbar.insertWidget(self.spaceraction,
                                                     self.label)
        self.closeAction.triggered.connect(self.close)
        self.copyAction.triggered.connect(self.copy_text)
        self.layout().addWidget(self.frame)
        self.frame.layout().addWidget(self.toolbar)
        self.frame.layout().addWidget(self.view)

        self.effect = QGraphicsOpacityEffect()
        self.label.setGraphicsEffect(self.effect)
        self.anim = QPropertyAnimation(self.effect, "opacity")
        self.anim.setDuration(2000)
        self.anim.setStartValue(1.0)
        self.anim.setEndValue(0.0)
        self.anim.setEasingCurve(QEasingCurve.OutQuad)
Ejemplo n.º 4
0
	def createAnimationFromToFor(widget, fromValue, toValue, duration, propName, curve = QEasingCurve.InOutCubic):
		anim = QPropertyAnimation(widget, propName)
		anim.setDuration(duration)
		anim.setStartValue(fromValue)
		anim.setEndValue(toValue)
		anim.setEasingCurve(curve)
		return anim
Ejemplo n.º 5
0
    def __init__(self, parent=None, animationEnabled=True):
        QFrame.__init__(self, parent)
        self.__animationEnabled = animationEnabled

        layout = StackLayout()

        self.__fadeWidget = CrossFadePixmapWidget(self)

        self.transitionAnimation = \
            QPropertyAnimation(self.__fadeWidget, "blendingFactor_", self)
        self.transitionAnimation.setStartValue(0.0)
        self.transitionAnimation.setEndValue(1.0)
        self.transitionAnimation.setDuration(100 if animationEnabled else 0)
        self.transitionAnimation.finished.connect(
            self.__onTransitionFinished
        )

        layout.addWidget(self.__fadeWidget)
        layout.currentChanged.connect(self.__onLayoutCurrentChanged)

        self.setLayout(layout)

        self.__widgets = []
        self.__currentIndex = -1
        self.__nextCurrentIndex = -1
Ejemplo n.º 6
0
 def anim_right(self):
     animation = QPropertyAnimation(self.label_icon, "geometry")
     animation.setDuration(250)
     animation.setStartValue(QRect(20, 0, 20, 20))
     animation.setEndValue(QRect(0, 0, 20, 20))
     animation.start()
     self.animation = animation
Ejemplo n.º 7
0
    def _default__geo_animator(self):
        """ Create the default property animator for the rubber band.

        """
        p = QPropertyAnimation(self._band, 'geometry')
        p.setDuration(self.band_geo_duration)
        return p
Ejemplo n.º 8
0
 def move(self, pos):
     ''' A simple animation to move the letter '''
     self.animation = QPropertyAnimation(self, 'pos')
     self.animation.setDuration(100)
     self.animation.setStartValue(self.scenePos())
     self.animation.setEndValue(pos)
     self.animation.start()
Ejemplo n.º 9
0
    def __init__(self, parent):
        super(MiniMap, self).__init__(parent)
        self.setWordWrapMode(QTextOption.NoWrap)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setReadOnly(True)
        self.setCenterOnScroll(True)
        self.setMouseTracking(True)
        self.viewport().setCursor(Qt.PointingHandCursor)
        self.setTextInteractionFlags(Qt.NoTextInteraction)

        self._parent = parent
        self.highlighter = None
        self.lines_count = 0

        self.connect(self._parent, SIGNAL("updateRequest(const QRect&, int)"),
                     self.update_visible_area)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")

        self.slider = SliderArea(self)
        self.slider.show()
Ejemplo n.º 10
0
 def setEndValue(self, endValue):
     """wrapper with debugging code"""
     tile = self.targetObject()
     if tile.element in Debug.animation:
         pName = self.pName()
         logDebug('%s: change endValue for %s: %s->%s  %s' % (self.ident(), pName, self.formatValue(self.endValue()),
                 self.formatValue(endValue), str(tile)))
     QPropertyAnimation.setEndValue(self, endValue)
Ejemplo n.º 11
0
    def _default__vis_animator(self):
        """ Create the default property animator for the rubber band.

        """
        p = QPropertyAnimation(self._band, 'windowOpacity')
        p.setDuration(self.band_vis_duration)
        p.finished.connect(self._on_vis_finished)
        return p
Ejemplo n.º 12
0
 def __init__(self, cid, data, cons=None, props=None):
     Cell.__init__(self, cid, data, cons, props)
     self.skin = None
     self.old_brush = None
     self.old_pen = None
     self.loaded = False
     self.initialMove = True
     self.animation = QPropertyAnimation()
Ejemplo n.º 13
0
 def doAanim_tilt(self, isTilted, duration=400, doStart=True):
     self.anim_tilt = QPropertyAnimation(self, "rotation")
     self.anim_tilt.setDuration(duration)
     self.anim_tilt.setStartValue(-30 if isTilted else 0)
     self.anim_tilt.setEndValue(0 if isTilted else -30)
     self.anim_tilt.setEasingCurve(QtCore.QEasingCurve.OutBack)
     if doStart:
         self.anim_tilt.start()
     return self.anim_tilt
Ejemplo n.º 14
0
 def doAanim_fade(self, isBecomeVisible, duration=400, doStart=True):
     self.anim_fade = QPropertyAnimation(self, "opacity")
     self.anim_fade.setDuration(duration)
     self.anim_fade.setStartValue(0.0 if isBecomeVisible else 1.0)
     self.anim_fade.setEndValue(1.0 if isBecomeVisible else 0.0)
     self.anim_fade.setEasingCurve(QtCore.QEasingCurve.InCirc)
     if doStart:
         self.anim_fade.start()
     return self.anim_fade
Ejemplo n.º 15
0
 def setEndValue(self, endValue):
     """wrapper with debugging code"""
     tile = self.targetObject()
     if tile.element in Debug.animation:
         pName = self.pName()
         logDebug('%s: change endValue for %s: %s->%s  %s' %
                  (self.ident(), pName, self.formatValue(self.endValue()),
                   self.formatValue(endValue), str(tile)))
     QPropertyAnimation.setEndValue(self, endValue)
Ejemplo n.º 16
0
    def __init__(self, id_, ad, nm, ip, ms='', gw='', dns='', parent=None):
        super(NetConfigTile, self).__init__(parent)
        self.animation = QPropertyAnimation(self, "size")
        self.setObjectName('tile')
        self.setCursor(QCursor(Qt.PointingHandCursor))

        effect = QGraphicsDropShadowEffect(self)
        effect.setOffset(0, 0)
        effect.setBlurRadius(20)
        self.setGraphicsEffect(effect)

        # self.setContextMenuPolicy(Qt.ActionsContextMenu)
        # action = QAction('edit', self)
        # self.addAction(action)
        self.setToolTip(
            'interfaz:  %s\nnombre: %s\nip:            %s\nmascara: %s\ngateway: %s\ndns:         %s'
            % (ad, nm, ip, ms, gw, dns))

        self.setFixedWidth(300)
        self.setMinimumHeight(90)
        self.ID = id_

        self.lbl_nm = QLabel(nm)
        self.lbl_nm.setObjectName('lbl_nm')
        self.lbl_ad = QLabel(ad)
        self.lbl_ad.setObjectName('lbl_ad')
        self.lbl_ip = QLabel(ip)
        self.lbl_ip.setObjectName('lbl_ip')
        self.lbl_ms = QLabel(ms)
        self.lbl_ms.setObjectName('lbl_ms')
        self.lbl_gw = QLabel(gw)
        self.lbl_gw.setObjectName('lbl_gw')
        self.lbl_dns = QLabel(dns)
        self.lbl_dns.setObjectName('lbl_dns')

        layout_left = QVBoxLayout()
        layout_left.addWidget(self.lbl_ad)
        layout_left.addWidget(self.lbl_nm)
        layout_left.addWidget(self.lbl_ip)

        layout_lbl = QHBoxLayout()
        layout_lbl.addLayout(layout_left)

        self.btn_remove = QPushButton()
        self.btn_remove.setFixedSize(QSize(60, 60))
        self.btn_remove.setObjectName('btn_remove')
        self.btn_remove.setCursor(QCursor(Qt.ArrowCursor))

        self.grid_layout = QGridLayout()
        self.grid_layout.addWidget(self.btn_remove, 1, 0)
        self.grid_layout.addLayout(layout_lbl, 1, 1, 1, 2)

        self.setLayout(self.grid_layout)
        self.setStyleSheet(self.load_style_sheet())

        self.connect(self.btn_remove, SIGNAL('released()'), self.remove_tile)
Ejemplo n.º 17
0
 def animation_geometry(self, widget, init=(35, 250, 250, 200), end=(35, 250, 250, 200), finish=None, duration=2000):
     init_rect = QRect(init[0], init[1], init[2], init[3])
     end_rect = QRect(end[0], end[1], end[2], end[3])
     self.animation = QPropertyAnimation(widget, "geometry")
     self.animation.setStartValue(init_rect)
     self.animation.setEndValue(end_rect)
     self.animation.setDuration(duration)
     self.animation.start()
     if finish:
         self.connect(self.animation, SIGNAL('finished()'), finish)
Ejemplo n.º 18
0
 def fade(self):
     if self.animation:
         self.animation.stop()
     self.deleted = True
     self.animation = QPropertyAnimation(self, 'opacity')
     self.animation.setDuration(250)
     self.animation.setStartValue(self.opacity())
     self.animation.setEndValue(0)
     self.animation.finished.connect(self.remove)
     self.animation.start()
Ejemplo n.º 19
0
 def createAnimationFromToFor(widget, fromValue, toValue, duration, propName, curve=QEasingCurve.InOutCubic):
     anim = QPropertyAnimation(widget, propName)
     anim.setDuration(duration)
     anim.setStartValue(fromValue)
     anim.setEndValue(toValue)
     anim.setEasingCurve(curve)
     return anim
Ejemplo n.º 20
0
 def returnToOriginalPoint(self):
     """ Label returns to its original position. The original position is stored when calling moveTo() method.
     """
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(
         QPoint(self.pos().x(),
                self.pos().y()))
     self.__moveAnimation.setEndValue(self.__starting_position)
     self.__moveAnimation.start()
Ejemplo n.º 21
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        self.__splitter = None
        self.__widget = None
        self.__animationEnabled = True
        self.__size = -1
        self.__expanded = False
        self.__animation = QPropertyAnimation(self, b"size_", self)

        self.__action = QAction("toogle-expanded", self, checkable=True)
        self.__action.triggered[bool].connect(self.setExpanded)
Ejemplo n.º 22
0
    def __init__(self, parent = None, connect_cb = None):
        QWidget.__init__(self, parent)
        self.widgets = connection_properties.Ui_connection_widget()
        w = self.widgets
        w.setupUi(self)
        self.container_height_exclusive = self.sizeHint().height() - self.widgets.proxy_params.sizeHint().height()
        self.combined_height = self.sizeHint().height()
        
        if HAS_QPROPERTY_ANIMATION:
            self.pp_show_animation = QPropertyAnimation(self, "size", self)
            self.pp_show_animation.setDuration(100)
            self.pp_show_animation.setStartValue(QSize(self.width(), self.container_height_exclusive))
            self.pp_show_animation.setEndValue(QSize(self.width(), self.combined_height))
            
            self.pp_hide_animation = QPropertyAnimation(self, "size", self)
            self.pp_hide_animation.setDuration(100)
            self.pp_hide_animation.setStartValue(QSize(self.width(), self.combined_height))
            self.pp_hide_animation.setEndValue(QSize(self.width(), self.container_height_exclusive))
        
        mkProtocolComboBox(w.w_improto)
        w.proxy_params.proxy_type_group = QButtonGroup(w.proxy_params)
        for i in ("http", "socks4", "socks5"):
            w.proxy_params.proxy_type_group.addButton(getattr(w, "proxy_type_" + i))
        self.connect_cb = connect_cb
        if connect_cb:
            signal_connect(w.w_connect, SIGNAL("clicked()"), self.submit)
            signal_connect(w.w_username, SIGNAL("returnPressed()"), self.submit)
            signal_connect(w.w_password, SIGNAL("returnPressed()"), self.submit)
        
        
        if HAS_QPROPERTY_ANIMATION:
            @QtCore.pyqtSlot("bool", name="setVisible")
            def proxy_setVisible(b):
                if b:
                    self.pp_show_animation.start()
                    QTimer.singleShot(self.pp_show_animation.duration(),
                                      lambda: type(w.proxy_params).setVisible(w.proxy_params, True))
                else:
                    self.pp_hide_animation.start()
                    type(w.proxy_params).setVisible(w.proxy_params, False)
            w.proxy_params.setVisible = proxy_setVisible

                
        def _hideEvent(e):
            if self.parent() and self.parent().layout():
                self.parent().layout().activate()
            type(w.proxy_params).hideEvent(w.proxy_params, e)
            
        w.proxy_params.hideEvent = _hideEvent
        w.proxy_params.setVisible(False)
        signal_connect(w.show_proxy_prefs, SIGNAL("toggled(bool)"), w.proxy_params.setVisible)
        self.setAutoFillBackground(True)
        w.proxy_params.setAutoFillBackground(False)
Ejemplo n.º 23
0
 def __init__(self, canvas):
     super(CurrentSelection, self).__init__(canvas)
     self.outline = QgsRubberBand(canvas)
     self.outline.setBrushStyle(Qt.NoBrush)
     self.outline.setWidth(5)
     self.outline.setIconSize(30)
     self.aniobject = CurrentSelection.AniObject(self)
     self.anim = QPropertyAnimation(self.aniobject, "alpha")
     self.anim.setDuration(500)
     self.anim.setStartValue(50)
     self.anim.setEndValue(100)
     self.anim.valueChanged.connect(self.value_changed)
Ejemplo n.º 24
0
 def __init__(self, minimap):
     QFrame.__init__(self, minimap)
     self._minimap = minimap
     self.setStyleSheet("background: gray; border-radius: 3px;")
     # Opacity
     self.effect = QGraphicsOpacityEffect()
     self.setGraphicsEffect(self.effect)
     self.effect.setOpacity(0.2)
     # Animación
     self.animation = QPropertyAnimation(self.effect, "opacity")
     self.animation.setDuration(150)
     # Cursor
     self.setCursor(Qt.OpenHandCursor)
Ejemplo n.º 25
0
 def returnToOriginalPoint(self):
     """ Panel returns in its original position. The original position is stored when calling moveTo() method.
     """
     if self.__is_moving:
         return
     self.__is_moving = True
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.finished.connect(self.__on_finished_moving)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(QPoint(self.pos().x(), self.pos().y()))
     self.__moveAnimation.setEndValue(self.__starting_position)
     self.__moveAnimation.start()
Ejemplo n.º 26
0
 def __init__(self, parent=None):
     '''
     Constructor
     '''
     QSlider.__init__(self, parent)
     self.setOrientation(QtCore.Qt.Horizontal)
     self.animationType = QEasingCurve.OutExpo
     self.animation = QPropertyAnimation(self, "value")
     self.animation.setDuration(250)
     self.animation.finished.connect(self.animationDone)
     self.resize(85, 50)
     self.clicked.connect(self.changeValue)
     self.setStyleSheet(self.styleKnob + self.styleBkgOFF)
Ejemplo n.º 27
0
 def moveTo(self, x, y):
     """ Move itself to a given point with the given animation in the given duration.
     @param x: X point coordinate
     @type x: int
     @param y: Y point coordinate
     @type y: int
     """
     self.__starting_position = QPoint(self.pos())
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(self.__starting_position)
     self.__moveAnimation.setEndValue(QPoint(x, y))
     self.__moveAnimation.start()
Ejemplo n.º 28
0
 def __init__(self, target, propName, endValue, parent=None):
     QPropertyAnimation.__init__(self, target, propName, parent)
     QPropertyAnimation.setEndValue(self, endValue)
     duration = Preferences.animationDuration()
     self.setDuration(duration)
     self.setEasingCurve(QEasingCurve.InOutQuad)
     target.queuedAnimations.append(self)
     Animation.nextAnimations.append(self)
     if target.element in Debug.animation:
         oldAnimation = target.activeAnimation.get(propName, None)
         if isAlive(oldAnimation):
             logDebug('new animation %s (after %s is done)' % (self, oldAnimation.ident()))
         else:
             logDebug('new animation %s' % self)
Ejemplo n.º 29
0
 def set_pos_animated(self, pos):
     if (self.pos() -
             pos).manhattanLength() < 6 or not self.graph.animate_plot:
         self.setPos(pos)
     else:
         t = 250
         if self._floating_animation and self._floating_animation.state(
         ) == QPropertyAnimation.Running:
             t = t - self._floating_animation.currentTime()
             self._floating_animation.stop()
         self._floating_animation = QPropertyAnimation(self, 'pos')
         self._floating_animation.setEndValue(pos)
         self._floating_animation.setDuration(t)
         self._floating_animation.start(QPropertyAnimation.KeepWhenStopped)
Ejemplo n.º 30
0
 def __init__(self, target, propName, endValue, parent=None):
     QPropertyAnimation.__init__(self, target, propName, parent)
     QPropertyAnimation.setEndValue(self, endValue)
     duration = Preferences.animationDuration()
     self.setDuration(duration)
     self.setEasingCurve(QEasingCurve.InOutQuad)
     target.queuedAnimations.append(self)
     Animation.nextAnimations.append(self)
     if target.element in Debug.animation:
         oldAnimation = target.activeAnimation.get(propName, None)
         if isAlive(oldAnimation):
             logDebug('new animation %s (after %s is done)' %
                      (self, oldAnimation.ident()))
         else:
             logDebug('new animation %s' % self)
Ejemplo n.º 31
0
 def __init__(self, parent):
     super(ScreensharingToolbox, self).__init__(parent)
     with Resources.directory:
         self.setupUi()
     parent.installEventFilter(self)
     self.animation = QPropertyAnimation(self, 'pos')
     self.animation.setDuration(250)
     self.animation.setDirection(QPropertyAnimation.Forward)
     self.animation.setEasingCurve(
         QEasingCurve.Linear)  # or OutCirc with 300ms
     self.retract_timer = QTimer(self)
     self.retract_timer.setInterval(3000)
     self.retract_timer.setSingleShot(True)
     self.retract_timer.timeout.connect(self.retract)
     self.resize(self.size().expandedTo(self.toolbox_layout.minimumSize()))
Ejemplo n.º 32
0
 def doAnim_slide(self, to_widget, duration=200, doStart=True):
     if to_widget is None:
         self.anim_slide = None
         return
     posGlobal = self.fields_widget.mapToGlobal(
         to_widget.geometry().center())
     posLocal = self.table_widget.mapFromGlobal(posGlobal)
     self.anim_slide = QPropertyAnimation(self, "pos")
     self.anim_slide.setDuration(duration)
     self.anim_slide.setStartValue(self.pos())
     self.anim_slide.setEndValue(posLocal)
     self.anim_slide.setEasingCurve(QtCore.QEasingCurve.InOutQuint)
     if doStart:
         self.anim_slide.start()
     return self.anim_slide
Ejemplo n.º 33
0
    def __init__(self, parent):
        super(HtmlViewerWidget, self).__init__(parent)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.view = QWebView()
        self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.frame = QFrame()
        self.frame.setLayout(QGridLayout())
        self.frame.layout().setContentsMargins(0, 0, 0, 0)

        self.toolbar = QToolBar()
        self.spacer = QWidget()
        self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"), "Copy Text")
        self.label = QLabel()
        self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"), "Close")
        self.spaceraction = self.toolbar.insertWidget(self.closeAction, self.spacer)
        self.labelaction = self.toolbar.insertWidget(self.spaceraction, self.label)
        self.closeAction.triggered.connect(self.close)
        self.copyAction.triggered.connect(self.copy_text)
        self.layout().addWidget(self.frame)
        self.frame.layout().addWidget(self.toolbar)
        self.frame.layout().addWidget(self.view)

        self.effect = QGraphicsOpacityEffect()
        self.label.setGraphicsEffect(self.effect)
        self.anim = QPropertyAnimation(self.effect, "opacity")
        self.anim.setDuration(2000)
        self.anim.setStartValue(1.0)
        self.anim.setEndValue(0.0)
        self.anim.setEasingCurve(QEasingCurve.OutQuad )
Ejemplo n.º 34
0
    def __init__(self, weditor):
        super(BaseDialog, self).__init__(weditor)
        self._weditor = weditor
        self.line = None
        # Popup
        self.setWindowFlags(Qt.Popup)
        # Posición
        self.qpoint = weditor.rect().topRight()
        self.global_point = weditor.mapToGlobal(self.qpoint)
        # Animación
        self._animation = QPropertyAnimation(self, "geometry")
        self._animation.setDuration(150)
        self._animation.setEasingCurve(QEasingCurve.Linear)

        key_escape = QShortcut(QKeySequence(Qt.Key_Escape), self)
        self.connect(key_escape, SIGNAL("activated()"), self._close)
Ejemplo n.º 35
0
    def __init__(self,parent=None):
        super(test,self).__init__(parent)
        self.pushbutton = MyButton('Popup Button')
        # self.pushbutton.setAutoFillBackground(False)
        self.pushbutton.move(0, 50)
        # self._alpha = 255
        # self.pushbutton.setStyle('plastique')

        # self.animation = QPropertyAnimation(self.pushbutton, "geometry")

        # self.animation.setDuration(1000)
        # self.animation.setKeyValueAt(0, QRect(100, 100, 50, 30));
        # self.animation.setKeyValueAt(0.8, QRect(150, 150, 50, 30));
        # self.animation.setKeyValueAt(1, QRect(100, 100, 50, 30));

        self.animation = QPropertyAnimation(self.pushbutton, "alpha")
        self.animation.setDuration(1000)
        # self.animation.setStartValue(20)
        # self.animation.setEndValue(255)

        self.animation.setKeyValueAt(0, 10)
        self.animation.setKeyValueAt(0.5, 200)
        self.animation.setKeyValueAt(1, 255)
        self.animation.setLoopCount(5)
        self.animation.start()
        # print(self.pushbutton)

        layout = QVBoxLayout()
        layout.addWidget(self.pushbutton)       
        # layout.addLayout(btnlayout2)
        # layout.addLayout(bottomlayout2)
        self.setLayout(layout)
        self.setGeometry(100, 100, 200, 200)
Ejemplo n.º 36
0
    def __init__(self, parent):
        super(MiniMap, self).__init__(parent)
        self.setWordWrapMode(QTextOption.NoWrap)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setReadOnly(True)
        self.setCenterOnScroll(True)
        self.setMouseTracking(True)
        self.viewport().setCursor(Qt.PointingHandCursor)
        self.setTextInteractionFlags(Qt.NoTextInteraction)

        self._parent = parent
        self.highlighter = None
        self.lines_count = 0

        self.connect(self._parent, SIGNAL("updateRequest(const QRect&, int)"), self.update_visible_area)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")

        self.slider = SliderArea(self)
        self.slider.show()
Ejemplo n.º 37
0
    def __init__(self, parent):
        super(MiniMap, self).__init__(parent)
        #self.setWordWrapMode(QTextOption.NoWrap)
        #self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        #self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setReadOnly(True)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
        self.setMarginWidth(1, 0)
        self.setFolding(self.NoFoldStyle, 2)
        #self.setCenterOnScroll(True)
        self.setMouseTracking(True)
        #self.viewport().setCursor(Qt.PointingHandCursor)
        #self.setTextInteractionFlags(Qt.NoTextInteraction)

        self._parent = parent
        #self.highlighter = None
        #self.lines_count = 0

        self.connect(self._parent, SIGNAL("updateRequest(const QRect&, int)"),
                     self.update_visible_area)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")
Ejemplo n.º 38
0
    def __init__(self, editor):
        super(MiniMap, self).__init__(editor)
        self._editor = editor
        self.SendScintilla(QsciScintilla.SCI_SETCARETSTYLE, 0)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
        self.SendScintilla(QsciScintilla.SCI_SETZOOM, -10)
        self.SendScintilla(QsciScintilla.SCI_SETREADONLY, 1)
        self.SendScintilla(QsciScintilla.SCI_HIDESELECTION, 1)
        self.SendScintilla(QsciScintilla.SCI_SETCURSOR, 8)
        # Hide markers
        for i in range(1, 5):
            self.SendScintilla(
                QsciScintilla.SCI_MARKERDEFINE, i, QsciScintilla.SC_MARK_EMPTY)
        self.SendScintilla(QsciScintilla.SCI_SETMARGINWIDTHN, 1, 0)

        self.setMouseTracking(True)

        if ACTIVATE_OPACITY:
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY)
            self.animation = QPropertyAnimation(self.goe, "opacity")
            self.animation.setDuration(300)

        self.slider = SliderArea(self)
        self.slider.show()
Ejemplo n.º 39
0
 def __init__(self, parent=None):
     """ Init Custom Switch Widget, set Animation and Glow effects """
     QSlider.__init__(self, parent)
     self.setOrientation(Qt.Horizontal)
     self.animationType = QEasingCurve.OutExpo
     self.animation = QPropertyAnimation(self, "value")
     self.animation.setDuration(1000)
     self.animation.finished.connect(self.animationDone)
     self.clicked.connect(self.changeValue)
     self.setStyleSheet(self.style_knob + self.style_off)
     self.glow = QGraphicsDropShadowEffect(self)
     self.glow.setOffset(0)
     self.glow.setBlurRadius(99)
     self.glow.setColor(QColor(99, 255, 255))
     self.setGraphicsEffect(self.glow)
     self.glow.setEnabled(False)
Ejemplo n.º 40
0
    def RestoreSize(self):
        ''' Restore Dialog Size '''
        dw = self.s.value("EquirectangularViewer/width")
        dh = self.s.value("EquirectangularViewer/height")

        if dw is None:
            return
        size = self.size()

        anim = QPropertyAnimation(self, 'size', self)
        anim.setStartValue(size)
        anim.setEndValue(QSize(dw, dh))
        anim.setDuration(1)
        anim.start()
        qApp.processEvents()
        return
Ejemplo n.º 41
0
 def setVisible(self, b):
     if not b:
         self._animation = QPropertyAnimation(self, "size", self)
         self._animation.setEndValue(QSize(self.width(), 0))
         signal_connect(self._animation, SIGNAL("finished()"), lambda: super(type(self), self).setVisible(False))
         self._animation.start()
     else:
         super(type(self), self).setVisible(b)        
 def __init__(self, parent=None):
     """ Inizializza il componente"""
     QStackedWidget.__init__(self, parent)
     self.__m_vertical=False
     self.__m_speed=500
     self.__m_animationtype = QEasingCurve.OutQuint #QEasingCurve.OutBack
     self.__m_now=0
     self.__m_next=0
     self.__m_pnow=QPoint(0,0)
     self.__m_active = False
     self.__direction = self.__SLIDE_TYPE.RIGHT2LEFT
     self.__animgroup = QtCore.QParallelAnimationGroup()
     self.__animgroup.finished.connect(self.__animationDone)
     self.__animnext = QPropertyAnimation(None, "pos")
     self.__animnow = QPropertyAnimation(None, "pos")
     #self.setMinimumSize(300, 300)
     self.setStyleSheet("background-color: rgb(184, 184, 184);")
Ejemplo n.º 43
0
	def __init__(self, cid, data, cons=None, props=None):
		Cell.__init__(self, cid, data, cons, props)
		self.skin = None
		self.old_brush = None
		self.old_pen = None
		self.loaded = False
		self.initialMove = True
		self.animation = QPropertyAnimation()
Ejemplo n.º 44
0
 def returnToOriginalPoint(self):
     """ Label returns to its original position. The original position is stored when calling moveTo() method.
     """
     self.__moveAnimation = QPropertyAnimation(self, "pos", self)
     self.__moveAnimation.setDuration(self.__move_time)
     self.__moveAnimation.setEasingCurve(self.__move_animation_type)
     self.__moveAnimation.setStartValue(QPoint(self.pos().x(), self.pos().y()))
     self.__moveAnimation.setEndValue(self.__starting_position)
     self.__moveAnimation.start()
Ejemplo n.º 45
0
class LineAnimation(Animation):
    def getPos(self):
        return self.__pos

    def setPos(self, pos):
        self.__pos = pos

    pos = pyqtProperty("QPointF", getPos, setPos)

    def __init__(self, p1, p2, color, duration, parent = None):
        super(LineAnimation, self).__init__(parent)
        self.startPoint = QPointF(p1[0], p1[1])
        self.endPoint = QPointF(p2[0], p2[1])
        self.__pos = self.startPoint
        self.color = color
        self.anim = QPropertyAnimation(self, "pos", self)
        self.anim.setStartValue(self.startPoint)
        self.anim.setEndValue(self.endPoint)
        self.anim.setDuration(duration)
        self.anim.valueChanged.connect(self.updated)
        self.anim.finished.connect(self.finished)

    def start(self):
        self.anim.start()

    def stop(self):
        self.anim.stop()

    def paint(self, painter):
        pen = QPen(Qt.black)
        pen.setWidthF(2.5)
        painter.setPen(pen)
        line = QLineF(self.startPoint, self.pos)
        painter.drawLine(line)
        if self.pos != self.startPoint:
            #draw arrowhead
            a = line.angle()
            l1 = QLineF.fromPolar(25, a - 155)
            l1.translate(self.pos)
            l2 = QLineF.fromPolar(25, a + 155)
            l2.translate(self.pos)
            painter.drawLine(l1)
            painter.drawLine(l2)
Ejemplo n.º 46
0
 def __init__(self, center, duration, parent = None):
     super(ExplodingAnimation, self).__init__(parent)
     self.center = center
     self.__radius = 1.0
     self.anim = QPropertyAnimation(self, "radius")
     self.anim.setStartValue(1.0)
     self.anim.setEndValue(100.0)
     self.anim.setDuration(duration)
     self.anim.setEasingCurve(QEasingCurve.OutExpo)
     self.anim.valueChanged.connect(self.updated)
     self.anim.finished.connect(self.finished)
Ejemplo n.º 47
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        self.__splitter = None
        self.__widget = None
        self.__animationEnabled = True
        self.__size = -1
        self.__expanded = False
        self.__animation = QPropertyAnimation(self, "size_", self)

        self.__action = QAction("toogle-expanded", self, checkable=True)
        self.__action.triggered[bool].connect(self.setExpanded)
Ejemplo n.º 48
0
 def __init__(self, pos_fn, cb, parent=None):
     super(type(self), self).__init__(parent, cb)
     self.setAutoFillBackground(True)
     if HAS_QPROPERTY_ANIMATION:
         self.animation = QPropertyAnimation(self, "size", self)
     if HAS_GRAPHICS_EFFECT:
         self.effect = ShadowAndAlphaEffect(blur = 15.0, transparency = 0.90, parent = self)
         self.setGraphicsEffect(self.effect)
     self.pos_fn = pos_fn
     saved_size = None
     self._parent = parent
Ejemplo n.º 49
0
def test():
    # 动来动去的按钮
    button = QPushButton("Button")
    button.show()

    # 生成一个动画, 它会修改button的geometry属性
    animation = QPropertyAnimation(button, "geometry")
    # 动画时间是10秒
    animation.setDuration(10000)
    # 开始的位置
    animation.setStartValue(QRect(0, 0, 100, 30))
    # 结束的位置
    animation.setEndValue(QRect(250, 250, 100, 30))
    # 开始吧
    animation.start()

    app.exec_()
Ejemplo n.º 50
0
 def __init__(self, p1, p2, color, duration, parent = None):
     super(LineAnimation, self).__init__(parent)
     self.startPoint = QPointF(p1[0], p1[1])
     self.endPoint = QPointF(p2[0], p2[1])
     self.__pos = self.startPoint
     self.color = color
     self.anim = QPropertyAnimation(self, "pos", self)
     self.anim.setStartValue(self.startPoint)
     self.anim.setEndValue(self.endPoint)
     self.anim.setDuration(duration)
     self.anim.valueChanged.connect(self.updated)
     self.anim.finished.connect(self.finished)
Ejemplo n.º 51
0
 def __init__(self, canvas):
     super(CurrentSelection, self).__init__(canvas)
     self.outline = QgsRubberBand(canvas)
     self.outline.setBrushStyle(Qt.NoBrush)
     self.outline.setWidth(5)
     self.outline.setIconSize(30)
     self.aniobject = CurrentSelection.AniObject(self)
     self.anim = QPropertyAnimation(self.aniobject, "alpha")
     self.anim.setDuration(500)
     self.anim.setStartValue(50)
     self.anim.setEndValue(100)
     self.anim.valueChanged.connect(self.value_changed)
Ejemplo n.º 52
0
 def set_pos_animated(self, pos):
     if (self.pos() - pos).manhattanLength() < 6 or not self.graph.animate_plot:
         self.setPos(pos)
     else:
         t = 250
         if self._floating_animation and self._floating_animation.state() == QPropertyAnimation.Running:
             t = t - self._floating_animation.currentTime()
             self._floating_animation.stop()
         self._floating_animation = QPropertyAnimation(self, 'pos')
         self._floating_animation.setEndValue(pos)
         self._floating_animation.setDuration(t)
         self._floating_animation.start(QPropertyAnimation.KeepWhenStopped)
Ejemplo n.º 53
0
class OutputTab(QTabWidget):
    def __init__(self,parent):
        QTabWidget.__init__(self,parent)
        self.setTabBar(MyTabBar(self))
        self.setMaximumHeight(200)#260
        self.anim = QPropertyAnimation(self, "geometry")
        self.anim.setDuration(3000)
        self.anim.setStartValue(QRect(0,0,100,0))
        self.anim.setEndValue(QRect(0,0,100,200))
        self.anim.setEasingCurve(QEasingCurve.InOutQuad)
        
        if(config.hide() == 1):
            #self.setFixedHeight(200)
            self.timer = QTimer(self)
            self.timer.timeout.connect(self.close)
            #self.connect(self.tabBar(), SIGNAL("tabno"),self.pop_out)
            #self.connect(self.tabBar(), SIGNAL("enter"),self.enter_show)
            #self.connect(self.tabBar(), SIGNAL("leave"),self.leave_hide)
            self.hide()
        else:
            #self.setFixedHeight(200)
            self.hide()
        
    def pop_out(self,no):
        #print "Hover Over Output tab: ",no
        if(no != 2):
            self.setCurrentIndex(no)
        
    def enter_show(self):
        self.anim.start()
        self.show()
        
    def leave_hide(self):
        self.timer.start(2000)
        
    def close(self):
        #self.setFixedHeight(30)
        self.timer.stop()    
        
        
Ejemplo n.º 54
0
 def __init__(self, minimap):
     QFrame.__init__(self, minimap)
     self._minimap = minimap
     self.setStyleSheet("background: gray; border-radius: 3px;")
     # Opacity
     self.effect = QGraphicsOpacityEffect()
     self.setGraphicsEffect(self.effect)
     self.effect.setOpacity(0.2)
     # Animación
     self.animation = QPropertyAnimation(self.effect, "opacity")
     self.animation.setDuration(150)
     # Cursor
     self.setCursor(Qt.OpenHandCursor)
Ejemplo n.º 55
0
 def __init__(self, parent=None):
     '''
     Constructor
     '''
     QSlider.__init__(self, parent)
     self.setOrientation(QtCore.Qt.Horizontal)
     self.animationType = QEasingCurve.OutExpo
     self.animation = QPropertyAnimation(self, "value")
     self.animation.setDuration(250)
     self.animation.finished.connect(self.animationDone)
     self.resize(85, 50)
     self.clicked.connect(self.changeValue)
     self.setStyleSheet(self.styleKnob + self.styleBkgOFF)