예제 #1
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)
예제 #2
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()
예제 #3
0
    def __init__(self, parent=None, caption=None):
        QLabel.__init__(self, parent)
        self.setText(self.accessibleName())
        self.setFont(QtGui.QFont("Arial", 12))
        self.__separator = chr(004)  #Used as separator while scrolling text

        #BLINK
        self.__blink_timer = QTimer(parent)
        self.__blink_timer.timeout.connect(self.__on_blink_timer)
        self.__blink_timer_interval = 1000

        #FADING
        self.__opacity_effect = QGraphicsOpacityEffect()
        self.__fading_timer = QTimer(parent)
        self.__fading_timer.timeout.connect(self.__on_fading_timer)
        self.__FADE_TYPE = Enum("IN", "OUT")
        self.__fade_time = 20
        self.__opacity = 1.0
        self.__opacity_fading_coefficient = 0.02
        self.__selected_fade_type = self.__FADE_TYPE.IN

        #SCROLLING
        self.__scrolling_timer = QTimer(parent)
        self.__scrolling_timer.timeout.connect(self.__on_scrolling_timer)
        self.__scroll_time = 1000
        self.__original_text = ""

        #MOVE
        self.__move_animation_type = QEasingCurve.Linear
        self.__move_time = 350
예제 #4
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()
예제 #5
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")
예제 #6
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)
예제 #7
0
    def setBgPic(self):
        pl = QtGui.QPalette(self)
        pic_path = os.path.join(os.getcwd(), r'./resource/bg.png')
        brush = QtGui.QBrush(QtGui.QPixmap(pic_path))

        pl.setBrush(QtGui.QPalette.Background, brush)
        self.setPalette(pl)
        self.setAutoFillBackground(True)

        self.opacity = QGraphicsOpacityEffect()
        self.opacity.setOpacity(0.5)
        self.setGraphicsEffect(self.opacity)
예제 #8
0
    def __init__(self, parent):
        super(SliderArea, self).__init__(parent)
        self._parent = parent
        self.setMouseTracking(True)
        self.setCursor(Qt.OpenHandCursor)
        color = "#858585"
        self.setStyleSheet("background: %s;" % color)
        self.goe = QGraphicsOpacityEffect()
        self.setGraphicsEffect(self.goe)
        self.goe.setOpacity(MINIMAP_MAX_OPACITY / 2)

        self.pressed = False
        self.__scroll_margins = None
예제 #9
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)
예제 #10
0
 def __init__(self, minimap):
     super(SliderArea, self).__init__(minimap)
     self._minimap = minimap
     self.pressed = False
     self.setMouseTracking(True)
     self.setCursor(Qt.OpenHandCursor)
     color = resources.CUSTOM_SCHEME.get(
         'MinimapVisibleArea', resources.COLOR_SCHEME['MinimapVisibleArea'])
     if ACTIVATE_OPACITY:
         self.setStyleSheet("background: %s;" % color)
         self.goe = QGraphicsOpacityEffect()
         self.setGraphicsEffect(self.goe)
         self.goe.setOpacity(settings.MINIMAP_MAX_OPACITY / 2)
     else:
         self.setStyleSheet("background: transparent;")
예제 #11
0
    def __init__(self, parent):
        super(SliderArea, self).__init__(parent)
        self._parent = parent
        self.setMouseTracking(True)
        self.setCursor(Qt.OpenHandCursor)
        color = resources.CUSTOM_SCHEME.get(
            'current-line', resources.COLOR_SCHEME['current-line'])
        if ACTIVATE_OPACITY:
            self.setStyleSheet("background: %s;" % color)
            self.goe = QGraphicsOpacityEffect()
            self.setGraphicsEffect(self.goe)
            self.goe.setOpacity(settings.MINIMAP_MAX_OPACITY / 2)
        else:
            self.setStyleSheet("background: transparent;")

        self.pressed = False
        self.__scroll_margins = None
예제 #12
0
 def __init__(self, weditor):
     QsciScintilla.__init__(self, weditor)
     self._weditor = weditor
     self._indentation = self._weditor._indentation
     self.setLexer(self._weditor.lexer())
     # Configuración Scintilla
     self.setMouseTracking(True)
     self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, False)
     self.SendScintilla(QsciScintilla.SCI_HIDESELECTION, True)
     self.setFolding(QsciScintilla.NoFoldStyle, 1)
     self.setReadOnly(True)
     self.setCaretWidth(0)
     self.setStyleSheet("background: transparent; border: 0px;")
     # Opacity
     self.effect = QGraphicsOpacityEffect()
     self.setGraphicsEffect(self.effect)
     self.effect.setOpacity(0.5)
     # Deslizador
     self.slider = Slider(self)
     self.slider.hide()
예제 #13
0
    def __init__(self, parent=None):
        QFrame.__init__(self, parent)

        #FADING
        self.__opacity_effect = QGraphicsOpacityEffect()
        self.__fading_timer = QTimer(parent)
        self.__fading_timer.timeout.connect(self.__on_fading_timer)
        self.__FADE_TYPE = Enum("IN", "OUT")
        self.__fade_time = 20
        self.__opacity = 1.0
        self.__opacity_fading_coefficient = 0.02
        self.__selected_fade_type = self.__FADE_TYPE.IN
        self.resizeEvent = self.__onResize

        #MOVE
        self.__move_animation_type = QEasingCurve.Linear
        self.__move_time = 350
        self.__is_moving = False

        #RESIZE
        self.__resize_animation_type = QEasingCurve.Linear
        self.__resize_time = 700
        self.__is_resizing = False

        #PIXMAP & MASCHERA
        self.__pmap = QPixmap(self.size())
        self.__pmap_fname = ""
        self.__show_mask_preview = False

        #SHADOW
        self.__shadow_Xoffset = 3.0 #default value
        self.__shadow_Yoffset = 3.0 #default value
        self.__shadow_blur_radius = 8.0 #default value
        self.__shadow_color = QColor(38,38,38,150) #default value

        self.__shadow_effect = QGraphicsDropShadowEffect()
        self.__shadow_effect.setXOffset(self.__shadow_Xoffset)
        self.__shadow_effect.setYOffset(self.__shadow_Yoffset)
        self.__shadow_effect.setBlurRadius(self.__shadow_blur_radius)
        self.__shadow_effect.setColor(self.__shadow_color)
        self._shadow_visible = False
예제 #14
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(self.tr("Configuraciones - Edis"))
        self.__sections = []
        # Opacity effect
        self.effect = QGraphicsOpacityEffect()
        self.setGraphicsEffect(self.effect)
        self.animation = QPropertyAnimation(self.effect, "opacity")

        Edis.load_component("preferences", self)
        # Install sections
        #lint:disable
        from src.ui.dialogs.preferences import (environment_configuration,
                                                editor_configuration,
                                                compiler_configuration)
        #lint:enable
        self.load_ui()
        key_escape = QShortcut(QKeySequence(Qt.Key_Escape), self)
        self.connect(key_escape, SIGNAL("activated()"), self.close)
        self.connect(self.btn_cancel, SIGNAL("clicked()"), self.close)
        self.connect(self.btn_guardar, SIGNAL("clicked()"), self._save)
예제 #15
0
    def __init__(self, parent=None):
        QToolButton.__init__(self, parent)

        #TESTO ALTERNATIVO
        #Spesso se il pulsante ha icona troppo grossa e quando per ragioni di spazio o altro non si può spostare
        #o ridimensionare il pulsante stesso, la label ha posizioni assurde e schifose. Aggiungerne una "+ controllabile"
        #è l'unico modo..
        self.__fixed_label = QLabel("alternative label", self)
        self.__fixed_label.move(0, self.geometry().height() - 35)
        self.__fixed_label.resize(self.geometry().width(),
                                  self.__fixed_label.geometry().height())
        self.__fixed_label.setAlignment(QtCore.Qt.AlignHCenter
                                        | QtCore.Qt.AlignVCenter)
        self.__font = QtGui.QFont("Arial", 10)
        self.__fixed_label.setFont(self.__font)
        self.__fixed_label.show()

        #INDICATORE STILE iOS
        self.__indicator = QLabel("0", self)
        self.__indicator.setStyleSheet(
            "border-image: url(':/images/backgrounds/indicator.png'); padding-right:1px; color: white;"
        )
        self.__indicator.geometry().setWidth(25)
        self.__indicator.geometry().setHeight(20)
        self.__indicator.setAlignment(QtCore.Qt.AlignHCenter
                                      | QtCore.Qt.AlignVCenter)
        self.__indicator.setVisible(False)
        self.setIndicatorPos(QPoint(self.width() - self.__indicator.width(),
                                    0))  #default top-right corner
        #Quando il pulsante viene ridimensionato (designer o meno) devo anche sistemare la label di conseguenza
        self.resizeEvent = self.__onResize
        self.__indicator.resizeEvent = self.__on_indicator_Resize

        self.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)

        self.clicked.connect(self.stopAllAnimations)

        #BLINK
        self.__blink_timer = QTimer(parent)
        self.__blink_timer.timeout.connect(self.__on_blink_timer)
        self.__blink_timer_interval = 1000

        #FADING
        self.__opacity_effect = QGraphicsOpacityEffect()
        self.__fading_timer = QTimer(parent)
        self.__fading_timer.timeout.connect(self.__on_fading_timer)
        self.__FADE_TYPE = Enum("IN", "OUT")
        self.__fade_time = 20
        self.__opacity = 1.0
        self.__opacity_fading_coefficient = 0.02
        self.__selected_fade_type = self.__FADE_TYPE.IN

        # ANIMAZIONI GROW
        self.__animationGrow = QPropertyAnimation(self, "iconSize", self)
        self.__animationGrow.setDuration(1000)
        self.__animationGrow.setEasingCurve(QEasingCurve.Linear)
        self.__animationGrow.finished.connect(self.__on_growed)

        self.__animationShrink = QPropertyAnimation(self, "iconSize", self)
        self.__animationShrink.setDuration(1000)
        self.__animationShrink.setEasingCurve(QEasingCurve.Linear)
        self.__animationShrink.finished.connect(self.__on_shrinked)

        self.__defaultIconDimension = 60
        self.__iconGrowsBy = 40
        self.__growing = False

        # ANIMAZIONI BOUNCE
        self.__animationUp = QPropertyAnimation(self, "pos", self)
        self.__animationUp.setDuration(200)
        self.__animationUp.setEasingCurve(QEasingCurve.Linear)
        self.__animationUp.finished.connect(self.__on_top_reached)

        self.__animationBounce = QPropertyAnimation(self, "pos", self)
        self.__animationBounce.setDuration(1000)
        self.__animationBounce.setEasingCurve(QEasingCurve.OutBounce)
        self.__animationBounce.finished.connect(self.__on_bounce_finished)

        self.__bouncing = False
        self.__startPos = QPoint(self.pos().x(), self.pos().y())

        #PIXMAP & MASCHERA
        self.__pmap = QPixmap(self.size())
        self.__pmap_fname = ""
        self.__show_mask_preview = False