コード例 #1
0
ファイル: versionmanager.py プロジェクト: pars-linux/uludag
    def __init__(self):
        self.versions = []
        self.parseDefinitionsFile()

        self.http = QHttp(None)
        QtCore.QObject.connect(self.http,
                               QtCore.SIGNAL('readyRead(QHttpResponseHeader)'),
                               self.updateProgress)
        QtCore.QObject.connect(self.http, QtCore.SIGNAL('done(bool)'),
                               self.updateFinished)
コード例 #2
0
    def __init__(self, parent=None):
        super(AdLoader, self).__init__(parent)

        #
        # Setup
        #
        self._adBgColor = self.AD_BGCOLOR
        self._adSize = self.AD_SIZE
        self._adInterval = self.AD_INTERVAL

        self._link = None
        self._data = deque([])
        self._imageCache = {}
        self._loadFailed = defaultdict(int)
        self.__http = QHttp()
        self.__lastReqId = -1

        self._timer = QTimer(self)
        self._timer.setInterval(self._adInterval * 1000)

        self.setObjectName("AdLoader")
        self.resize(*self._adSize)
        self.mainLayout = QHBoxLayout(self)
        self.mainLayout.setMargin(0)
        self.adDisplay = QLabel(self)
        self.adDisplay.setObjectName("AdDisplay")
        self.adDisplay.setText("")
        self.adDisplay.setScaledContents(False)
        self.adDisplay.setTextInteractionFlags(Qt.NoTextInteraction)
        self.mainLayout.addWidget(self.adDisplay)

        self.setStyleSheet("#AdDisplay {background-color: %s}" %
                           self._adBgColor)

        #		self._page = QWebPage()
        #		self._page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
        #		self._page.mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
        #		self._lastNetworkReply = None
        #		self._nam = self._page.networkAccessManager()

        self.adDisplay.mousePressEvent = lambda event: self.adDisplay.emit(
            SIGNAL("clicked"))

        #		self.connect(self._page, SIGNAL("loadFinished(bool)"), self._loadFinished)
        #		self.connect(self._nam, SIGNAL("finished (QNetworkReply *)"), self._networkReply)

        self.connect(self.__http, SIGNAL("requestFinished (int,bool)"),
                     self._loadFinished)
        self.connect(self.adDisplay, SIGNAL("clicked"), self.linkClicked)
        self.connect(self._timer, SIGNAL("timeout()"), self.rotateAd)
コード例 #3
0
    def __init__(self, parent=None):
        super(Downloader, self).__init__(parent)
        self.setupUi(self)

        self.httpGetId = 0
        self.httpRequestAborted = False

        self.http = QHttp(self)
        self.http.requestFinished.connect(self.httpRequestFinished)
        self.http.dataReadProgress.connect(self.updateDataReadProgress)
        self.http.responseHeaderReceived.connect(self.readResponseHeader)
        self.closebutton.clicked.connect(self.cancelDownload)
        self.button_browse.clicked.connect(self.open_file)
        self.button_start.clicked.connect(self.downloadFile)

        self.setWindowTitle('Download Example')