def __init__(self):

        QGraphicsView.__init__(self)
        self.ofs = 0
        self.factor = 1
        self.scene = QGraphicsScene()
        self.background = None
        self.icons = []
        self.iconTimeLine = QTimeLine()
        self.backgroundTimeLine = QTimeLine()

        self.setScene(self.scene)

        self.background = self.scene.addPixmap(QPixmap(":/background.jpg"))
        self.background.setZValue(0.0)
        self.background.setPos(0, 0)

        for i in range(7):
            str = QString(":/icon%1.png").arg(i + 1)
            icon = self.scene.addPixmap(QPixmap(str))
            icon.setPos(320 + i * 64, 400)
            icon.setZValue(1.0)
            self.icons.append(icon)

        self.setFixedSize(320, 480)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        self.connect(self.iconTimeLine, SIGNAL("frameChanged(int)"), self,
                     SLOT("moveIcons(int)"))
        self.iconTimeLine.setCurveShape(QTimeLine.EaseInOutCurve)

        self.connect(self.backgroundTimeLine, SIGNAL("frameChanged(int)"),
                     self, SLOT("moveBackground(int)"))
        self.connect(self.backgroundTimeLine, SIGNAL("finished()"), self,
                     SLOT("adjustParameters()"))
        self.backgroundTimeLine.setCurveShape(QTimeLine.EaseInOutCurve)

        self.controls = Ui_ControlsForm()

        toolWidget = QWidget(self)
        toolWidget.setWindowFlags(Qt.Tool | Qt.WindowTitleHint)
        self.controls.setupUi(toolWidget)
        toolWidget.show()

        self.connect(self.controls.speedSlider, SIGNAL("valueChanged(int)"),
                     self, SLOT("adjustParameters()"))
        self.connect(self.controls.normalButton, SIGNAL("clicked()"), self,
                     SLOT("adjustParameters()"))
        self.connect(self.controls.parallaxButton, SIGNAL("clicked()"), self,
                     SLOT("adjustParameters()"))
        self.connect(self.controls.leftButton, SIGNAL("clicked()"), self,
                     SLOT("slideLeft()"))
        self.connect(self.controls.rightButton, SIGNAL("clicked()"), self,
                     SLOT("slideRight()"))

        self.slideBy(-320)
        self.adjustParameters()
Exemple #2
0
    def __init__(self, parent=None, direction="ltr", rtf=False):
        """ Creates a new QPageWidget on given parent object. 

        parent: QWidget parent
        direction: "ltr" -> Left To Right
                   "ttb" -> Top To Bottom
        rtf: Return to first, if its True it flips to the first page 
             when next page requested at the last page
        """
        # First initialize, QPageWidget is based on QScrollArea
        QScrollArea.__init__(self, parent)

        # Properties for QScrollArea
        self.setFrameShape(QFrame.NoFrame)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setWidgetResizable(True)

        # Main widget, which stores all Pages in it
        self.widget = QWidget(self)

        # Layout based on QBoxLayout which supports Vertical or Horizontal layout
        if direction == "ltr":
            self.layout = QBoxLayout(QBoxLayout.LeftToRight, self.widget)
            self.__scrollBar = self.horizontalScrollBar()
            self.__base_value = self.width
        else:
            self.layout = QBoxLayout(QBoxLayout.TopToBottom, self.widget)
            self.__scrollBar = self.verticalScrollBar()
            self.__base_value = self.height
        self.layout.setSpacing(0)
        self.layout.setMargin(0)

        # Return to first
        self.__return_to_first = rtf

        # TMP_PAGE, its using as last page in stack
        # A workaround for a QScrollArea bug
        self.__tmp_page = Page(QWidget(self.widget))
        self.__pages = [self.__tmp_page]
        self.__current = 0
        self.__last = 0

        # Set main widget
        self.setWidget(self.widget)

        # Animation TimeLine
        self.__timeline = QTimeLine()
        self.__timeline.setUpdateInterval(2)

        # Updates scrollbar position when frame changed
        self.__timeline.frameChanged.connect(
            lambda x: self.__scrollBar.setValue(x))

        # End of the animation
        self.__timeline.finished.connect(self._animateFinished)

        # Initialize animation
        self.setAnimation()
        self.setDuration()
Exemple #3
0
 def __init__(self, parent=None):
     super(TimedProgressBar, self).__init__(parent, minimum=0, maximum=100)
     self._timeline = QTimeLine(updateInterval=100,
                                frameChanged=self.setValue)
     self._timeline.setFrameRange(0, 100)
     self._hideTimer = QTimer(timeout=self._done,
                              singleShot=True,
                              interval=3000)
Exemple #4
0
 def __init__(self,resource,parent=None,steps=20,width=15,height=15):
     QLabel.__init__(self,parent)
     self._resource=resource
     self._steps=steps
     self._width=width
     self._height=height
     self._progressTimeLine = QTimeLine(1000, self)
     self._progressTimeLine.setFrameRange(0, self._steps)
     self._progressTimeLine.setLoopCount(0)
     self.connect(self._progressTimeLine, SIGNAL("frameChanged(int)"), self.setProgress)
     self._renderPixmaps()
     self.setProgress(0)
Exemple #5
0
    def __init__(self, old_widget, new_widget):
        QWidget.__init__(self, new_widget)

        self.old_pixmap = QPixmap(new_widget.size())
        old_widget.render(self.old_pixmap)
        self.pixmap_opacity = 1.0

        self.timeline = QTimeLine()
        self.timeline.valueChanged.connect(self.animate)
        self.timeline.finished.connect(self.close)
        self.timeline.setDuration(555)
        self.timeline.start()

        self.resize(new_widget.size())
        self.show()
Exemple #6
0
    def __init__(self, old_object, new_object, delay):
        QWidget.__init__(self, new_object)

        self.old_pix_map = QPixmap(new_object.size())
        old_object.render(self.old_pix_map)
        self.pix_map_opacity = 1.0

        self.time_line = QTimeLine()
        self.time_line.valueChanged.connect(self.fade)
        self.time_line.finished.connect(self.close)
        self.time_line.setDuration(delay)
        self.time_line.start()

        self.resize(new_object.size())
        self.show()
    def __init__(self, publisher, plugin, parentWidget=None):
        DialogBase.__init__(self, parentWidget)
        self.setupUi(self)
        self.setObjectName("ProgressDialog")
        self.viewButton_.setEnabled(False)

        self._publisher = publisher
        self._plugin = plugin
        self._parent = parentWidget
        self._cancelled = False
        self._timeline = QTimeLine(1000 * 60, self)
        self._timeline.setFrameRange(0, 2 * 60)
        self._timeline.setLoopCount(0)
        self.progressBar_.setRange(0, 60)
        self.connect(self._timeline, QtCore.SIGNAL("frameChanged(int)"),
                     self.updateProgressBar)

        self.outputGroupBox_ = QGroupBox("Script output", None)

        self.outputTextEdit_ = QTextEdit()
        self.outputTextEdit_.setTextInteractionFlags(
            Qt.TextSelectableByKeyboard
            | Qt.TextSelectableByMouse)
        self.outputTextEdit_.setReadOnly(True)
        self.outputTextEdit_.setTabChangesFocus(True)
        self.outputTextEdit_.setAcceptRichText(False)

        groupBoxLayout = QVBoxLayout()
        groupBoxLayout.setObjectName("groupBoxLayout")
        groupBoxLayout.setMargin(0)
        groupBoxLayout.addWidget(self.outputTextEdit_)
        self.outputGroupBox_.setLayout(groupBoxLayout)

        gridLayout = QGridLayout()
        gridLayout.setSizeConstraint(gridLayout.SetFixedSize)
        gridLayout.addWidget(self.progressLabel_, 0, 0, 1, 4)
        gridLayout.addWidget(self.progressBar_, 1, 0, 1, 4)
        gridLayout.addWidget(self.detailsCheckBox_, 2, 0)
        hSpacer = QSpacerItem(250, 10, QSizePolicy.Expanding)
        gridLayout.addItem(hSpacer, 2, 1)

        gridLayout.addWidget(self.viewButton_, 2, 2)
        gridLayout.addWidget(self.cancelButton_, 2, 3)
        gridLayout.addWidget(self.outputGroupBox_, 3, 0, 1, 4)

        self.setLayout(gridLayout)

        self.outputGroupBox_.setVisible(False)
 def __init__(self, file, parent=None):
     QGraphicsSvgItem.__init__(self, file, parent)
     self.animation = QGraphicsItemAnimation()
     self.animation.setItem(self)
     self.timeline = QTimeLine(300)
     self.animation.setTimeLine(self.timeline)
Exemple #9
0
    def __init__(self, parent, standAlone=True, app=None):
        QtGui.QWidget.__init__(self, parent)

        # Create the ui
        self.ui = Ui_mainManager()
        self.app = app
        self.lastEditedPackage = None
        self.lastEditedData = None
        self.lastEditedInfo = None
        self.isEditBox = None

        # Network Manager can run as KControl Module or Standalone
        if standAlone:
            self.ui.setupUi(self)
            self.baseWidget = self
        else:
            self.ui.setupUi(parent)
            self.baseWidget = parent

        # Workaround for Pyuic Problem
        self.ui.buttonCancelMini.setText('')

        # Set visibility of indicators
        self.ui.workingLabel.hide()
        self.ui.refreshButton.hide()

        # Call Comar
        self.iface = NetworkIface()
        self.widgets = {}

        # Populate Packages
        self.packages = {}
        for package in self.iface.packages():
            self.packages[package] = self.iface.linkInfo(package)

        # Naruto
        self.animator = QTimeLine(ANIMATION_TIME, self)

        # List of functions to call after animation is finished
        self.animatorFinishHook = []

        # Let look what we can do
        self.refreshBrowser()

        # Security dialog
        self.securityDialog = SecurityDialog(parent)
        self.securityFields = []
        self.securityValues = {}

        # Nameserver dialog
        self.nameserverDialog = NameServerDialog(parent)

        # Preparing for animation
        self.ui.editBox.setMaximumHeight(TARGET_HEIGHT)
        self.lastAnimation = SHOW

        # Animator connections, Naruto loves Sakura-chan
        self.connect(self.animator, SIGNAL("frameChanged(int)"), self.animate)
        self.connect(self.animator, SIGNAL("finished()"), self.animateFinished)

        # Hide editBox when clicked mini cancel
        self.connect(self.ui.buttonCancelMini, SIGNAL("clicked()"),
                     self.hideEditBox)

        # Save changes when clicked Apply, Reject changes when clicked Cancel
        self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.hideEditBox)
        self.connect(self.ui.buttonBox, SIGNAL("accepted()"),
                     self.applyChanges)

        # Show NameServer Settings Dialog
        self.ui.buttonNameServer.setIcon(KIcon("configure"))
        self.connect(self.ui.buttonNameServer, SIGNAL("clicked()"),
                     self.slotNameServerDialog)

        # Filter
        self.connect(self.ui.filterBox, SIGNAL("currentIndexChanged(int)"),
                     self.filterList)

        # Refresh button for scanning remote again..
        self.connect(self.ui.refreshButton, SIGNAL("leftClickedUrl()"),
                     self.filterESSID)

        # Security details button
        self.connect(self.ui.pushSecurity, SIGNAL("clicked()"),
                     self.openSecurityDialog)

        # Security types
        self.connect(self.ui.comboSecurityTypes,
                     SIGNAL("currentIndexChanged(int)"),
                     self.slotSecurityChanged)

        # Update service status and follow Comar for sate changes
        self.getConnectionStates()